thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

How to integrate Yolo .pb file in Unity with OpenCVForUnity #1083

Open Ana6Dlab opened 5 years ago

Ana6Dlab commented 5 years ago

I've trainned my yolo model for 13875 stages as below:

python3 flow --model cfg/yolo-voc-3c.cfg --load bin/tiny-yolo-voc.weights --train --trainer adam --annotation xml/ --dataset output/ --gpu 1.0 --save 2000 --keep 500 --epoch 100 > progress.txt

Then I've saved the result as .pb file, which seems to work on darkflow environment, but it doesn't predict anything when it's integrated into OpenCVForUnity. This integration it's done by setting the dnn net as _Net yoloNet = readNet("pb_pathfile/yolo-voc-3c.pb") , passing the blob input to the net (yoloNet.setinput(blob)) and doing its forward, it returns no boundingbox outputs. But there must being something wrong on that transference since I know the yolo-voc-3c.pb properly works, because it returns both bounding boxes and json predictions when testing: _python3 flow --pbLoad built_graph/yolo-voc-3c.pb --metaLoad built_graph/yolo-voc-3c.meta --imgdir sampleimg/ --json

Does anyone know how to integrate yolo into OpenCV for unity ensuring a working model?