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

AssertionError after training custom model #956

Closed tanmay-bhatnagar closed 5 years ago

tanmay-bhatnagar commented 5 years ago

I trained a model using the --train argument provided. After training in the ckpt folder i got the following files : 1 .index file 2 .meta file 3 .profile file 4 .data-00000-of-00001 file I think the 4th file is the saved weights so I loaded it using the --load argument along with the CFG i used for training the model. I gave the following command - flow --model cfg/yolov2-tiny-voc-1c.cfg --load bin/yolov2-tiny-voc-1c-4.weights This gave me an error: AssertionError: expect 63082056 bytes, found 189197224 What is the fix? I am loading the correct CFG. I even re-trained the model using the same CFG to check if it was the correct one and the training ran without any issues.

lvzcl commented 5 years ago

I face the same problem, do you solve it? can you give me some advices

tanmay-bhatnagar commented 5 years ago

I face the same problem, do you solve it? can you give me some advices

I solved the problem. The .data file is not the saved weights file. Darkflow does not save weights but rather saves the tensorflow graph at that epoch. So if you want to load the custom model give this command - flow --model cfg/yolov2-tiny-voc-1c.cfg --load 620 --demo camera here 620 is the number of the step at which the graph was saved. Ask if you have any further doubts I am very active on github. I'll close the issue after your doubts are cleared.

ankitAMD commented 4 years ago

I face the same problem, do you solve it? can you give me some advices

I solved the problem. The .data file is not the saved weights file. Darkflow does not save weights but rather saves the tensorflow graph at that epoch. So if you want to load the custom model give this command - flow --model cfg/yolov2-tiny-voc-1c.cfg --load 620 --demo camera here 620 is the number of the step at which the graph was saved. Ask if you have any further doubts I am very active on github. I'll close the issue after your doubts are cleared.

i trained the model on custom images which is train properly ....when i running testing code i have to change threshold value for differenet test images . so what should i do that i get all the detection on different test_images of the same class on same threshold ?