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.07k forks source link

object deteciton with flow giving a empty json and no bounding boxes #1010

Open hakS07 opened 5 years ago

hakS07 commented 5 years ago

I'm trying to flow this tuto https://modelzoo.co/model/yolo-tensorflow i did try 3 ways

flow --imgdir sample_img/ --model cfg/yolov2-tiny.cfg --load bin/yolov2-tiny.weights --json

flow --imgdir sample_img/ --model cfg/yolov2-tiny.cfg --load bin/yolov2-tiny.weights --labels labels.txt --threshold 0.6 --json

python flow --imgdir sample_img/ --model cfg/yolov2-tiny.cfg --load bin/yolov2-tiny.weights --labels labels.txt --threshold 0.6 --json but nothing change Capture du 2019-03-27 11-00-38 Capture du 2019-03-27 11-01-14 Capture du 2019-03-27 11-02-07 knowing that : 1) i changed my input size to 32 to solve this pb

AssertionError: expect 44948596 bytes, found 44948600

2)i changed the self.offset from 16 to 20 to solve this pb https://sites.google.com/view/tensorflow-example-java-api/complete-guide-to-train-yolo/convert-darknet-weights-to-pb-file

skofot commented 5 years ago

Have you changed filters in the last convolutional layer to num * (classes + 5), in your case 50? The reason I ask is because that AssertionError is usually a result of missing that.

hakS07 commented 5 years ago

@skofot thnkx for your reply it's really helpful. But now i got again this error

AssertionError: expect 44948596 bytes, found 44948600

However i changed the self.offset to 20 in the file loader.py and the input size to 32 in the file .cfg but nothing change Capture du 2019-03-27 14-03-38

skofot commented 5 years ago

Are you using the original settings (offset and input size) now that the "filters"-option is correct? If not, try it out.

As to your original issue of not getting any output: I noticed that yolov2-tiny is originally trained for 80 classes while you're using 5. I tried reproducing your errors using tiny-yolo-voc and got very mixed results when reducing the number of classes. With 20 classes, which is the original amount, there were no problems. When reducing to 10 not a single object was found, and when reducing to only 1 hundreds of false positives were detected on each image.

Now I barely have any experience using pre-trained weights but my suggestion is to either: A) Find the labels for yolov2-tiny and try with the original 80 classes. or B) Try using tiny-yolo-voc instead, labels here, cfg here and weights here.

hakS07 commented 5 years ago

@skofot thnx for your reply now i'm using the original settings classes=80 filtres= 425 size=416 self.offset=16 yolov2-tiny.cgf and .weights igot this error AssertionError: expect 44948596 bytes, found 44948600 i try to change the offset to 20 but nothing change

skofot commented 5 years ago

I just tried follow the guide you linked and got the same error. If you can't solve it the only solution I have for you is to change model to tiny-yolo-voc (everything linked above) instead of yolov2-tiny and run python flow --model cfg/tiny-yolo-voc.cfg --load bin/tiny-yolo-voc.weights --imgdir sample_img

hakS07 commented 5 years ago

@AntonClaesson yes i did it but I got the same error Capture du 2019-03-27 15-25-54 Capture du 2019-03-27 14-03-38

hakS07 commented 5 years ago

@skofot thank you

aditya-3 commented 5 years ago

follow the procedure below. change the value of filter in the last convolution layer to 50 (if you are using 5 classes) change the value of offset in loader.py to Z Y=existing offset value X= 44948600 - 44179096 (X=found-expect) Z=X+Y

hakS07 commented 5 years ago

@aditya-3 thnx