def test_it_handling(): # to test fix for issue #6 src2Name = imc.DataDir2IterImNames() name2Im = imc.File2Im() bgr = imc.RGB2BGR() chain = ch.Chainer([src2Name, name2Im, bgr]) for x in chain.produce('./tmp/'): print x
def run_rcnn(): imName = get_sample_imname() imProd = imc.File2Im() bgr = imc.RGB2BGR() rcnn = cc.Im2RCNNDet() chain = ch.Chainer([imProd, bgr, rcnn]) im, allDet = chain.produce(imName) return im, allDet
def run_rcnn_iter(): dataSrc = dc.GetDataDir() src2Im = imc.DataDir2IterIms() bgr = imc.RGB2BGR() rcnn = cc.Im2PersonDet() vis = vc.VisImBBox() chain = ch.Chainer([dataSrc, src2Im, bgr, rcnn, (vis, [[1,0],[-1,0]])]) return chain
def save_rcnn_op(dataFn, opName): opFile = osp.join('tmp', opName) dataSrc = dataFn src2Name = imc.DataDir2IterImNames() name2Im = imc.File2Im() bgr = imc.RGB2BGR() rcnn = cc.Im2PersonDet() imKey = mc.File2SplitLast() chain = ch.Chainer([dataSrc, src2Name, name2Im, bgr, \ rcnn, (imKey, [(1,0)])], opData=[(-1,0),(-2,0)]) count = 0 data = [] while True: op = chain.produce() if op is None: break frame, bbox = op data.append([frame, 'person', bbox]) count += 1 print (count) pickle.dump({'person_det': data}, open(opFile, 'w'))
def __init__(self, prms=[{}, {}]): ch.ChainObject.__init__(self, prms) oList = [] oList.append(DataDir2IterImNames(self.prms_[0])) oList.append(File2Im(self.prms_[1])) self.chain_ = ch.Chainer(oList)