def __init__(self, poseNet, config, di, comrefNet=None):
"""
Initialize data
:param poseNet: network for pose estimation
:param config: configuration
:param di: depth importer
:param comrefNet: refinement network from center of mass detection
:return: None
"""
# handpose CNN
self.importer = di
self.poseNet = poseNet
self.comrefNet = comrefNet
# configuration
self.config = config
self.initialconfig = config
# synchronization between threads
self.queue = Queue()
self.stop = Value('b', False)
# for calculating FPS
self.lastshow = time.time()
# hand left/right
self.hand = self.HAND_LEFT
# initial state
self.state = self.STATE_IDLE
# hand size estimation
self.handsizes = []
self.numinitframes = 50
# hand tracking or detection
self.tracking = False
self.lastcom = (0, 0, 0)
# Force network to compile output in the beginning
self.poseNet.computeOutput(numpy.zeros(self.poseNet.cfgParams.inputDim, dtype='float32'))
if self.comrefNet is not None:
self.comrefNet.computeOutput([numpy.zeros(sz, dtype='float32') for sz in self.comrefNet.cfgParams.inputDim])
评论列表
文章目录