Closed himanshurawlani closed 6 years ago
Hey Himanshu,
I downloaded the cfg and weights from the original author - Darknet https://github.com/pjreddie/darknet/blob/master/cfg/tiny-yolo.cfg https://pjreddie.com/media/files/tiny-yolo.weights
However, I think weights are not the problem but the loader.py
. It looks to me that the original weight file had a different size of header, says, used to be 16 bytes and now 20 bytes. I modified the loader.py
a bit for this tiny-yolo.weights
, of course the weights file you have may be a bit different, you can change the offset (header) for your weights files. You can see that I changed the offset here - self.WEIGHTS_HEADER_OFFSET = 20
https://github.com/nicolefinnie/DarkEllie/blob/master/darkflow/utils/loader.py
It may not be the same issue you hit, I hope it will be a good hint for you though.
Yes, I saw your loader.py file and also made the same changes. After making those changes I get another error saying something similar to
expected size 441568900 but found 441528690
Not sure about the exact value but it was something like this only...
Hey Himanshu, this is the same issue as the one that I tried to fix https://github.com/thtrieu/darkflow/issues/421
Change the offset to the discrepancy you are still missing, e.g expected 6 bytes found 10 bytes, then add the offset by another 4 bytes. Could be the weights you are using or you retrained are different than my tiny yolo v2 coco.
Hey, I followed the fix that you mentioned. But I'm still getting the same error.
AssertionError: expect 44948596 bytes, found 44948600
These are the exact values that I'm getting in the error.
You can check my loader.py file here: https://github.com/himanshurawlani/tiny-yolo-voc/blob/master/darkflow/darkflow/utils/loader.py
I have set self.offset=20
I got it ! I'm sorry I never reinstalled Darkflow ! Really sorry ! I'm a Noob ! I realised it when I saw the path of loader.py in the stacktrace. It was not pointing to the Darkflow directory but the python dist-packages. Anyway thank you very much for your help !
@himanshurawlani ah, I finally saw your installing darkflow on your local machine :) I overlooked that part. I'm glad you solved the problem by yourself, have a nice day.
I'm trying very hard to get matching cfg and weights file for tiny-yolo pretrained on COCO dataset but I'm not able to run Darkflow's training command.
Command:
flow --model cfg/tiny-yolo-4c.cfg --load bin/tiny-yolo.weights --train --annotation "train/Annotation/" --dataset "train/Images/" --gpu 1.0 --batch 32 --trainer adam
Output: /usr/local/lib/python3.6/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
. from ._conv import register_converters as _register_convertersParsing ./cfg/tiny-yolo.cfg Parsing cfg/tiny-yolo-4c.cfg Loading bin/tiny-yolo.weights ... Traceback (most recent call last): File "/usr/local/bin/flow", line 6, in
cliHandler(sys.argv)
File "/usr/local/lib/python3.6/dist-packages/darkflow/cli.py", line 26, in cliHandler
tfnet = TFNet(FLAGS)
File "/usr/local/lib/python3.6/dist-packages/darkflow/net/build.py", line 58, in init
darknet = Darknet(FLAGS)
File "/usr/local/lib/python3.6/dist-packages/darkflow/dark/darknet.py", line 27, in init
self.load_weights()
File "/usr/local/lib/python3.6/dist-packages/darkflow/dark/darknet.py", line 82, in load_weights
wgts_loader = loader.create_loader(args)
File "/usr/local/lib/python3.6/dist-packages/darkflow/utils/loader.py", line 105, in create_loader
return load_type(path, cfg)
File "/usr/local/lib/python3.6/dist-packages/darkflow/utils/loader.py", line 19, in init
self.load(args)
File "/usr/local/lib/python3.6/dist-packages/darkflow/utils/loader.py", line 70, in load
val = walker.walk(new.wsize[par])
File "/usr/local/lib/python3.6/dist-packages/darkflow/utils/loader.py", line 132, in walk
'Over-read {}'.format(self.path)
AssertionError: Over-read bin/tiny-yolo.weights
Please can you upload the cfg and weights file used for retraining and generating .pb file...