Darkflow: Darknet YOLO is 4 bytes off for tiny-yolo and not working for tiny-yolo-voc

Created on 24 Mar 2018  路  6Comments  路  Source: thtrieu/darkflow

I was trying to use the tiny-yolo.weights for my project and I'm sure that I'm using the correct corresponding cfg file however it keeps on giving me this error:

Parsing ./cfg/tiny-yolo.cfg
Parsing cfg/tiny-yolo.cfg
Loading bin/tiny-yolo.weights ...
Traceback (most recent call last):
File "/Users/user/anaconda2/bin/flow", line 6, in
cliHandler(sys.argv)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/cli.py", line 26, in cliHandler
tfnet = TFNet(FLAGS)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/net/build.py", line 58, in __init__
darknet = Darknet(FLAGS)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/dark/darknet.py", line 27, in __init__
self.load_weights()
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/dark/darknet.py", line 82, in load_weights
wgts_loader = loader.create_loader(args)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/utils/loader.py", line 105, in create_loader
return load_type(path, cfg)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/utils/loader.py", line 19, in __init__
self.load(
args)
File "/Users/user/anaconda2/lib/python2.7/site-packages/darkflow/utils/loader.py", line 77, in load
walker.offset, walker.size)
AssertionError: expect 44948596 bytes, found 44948600

When I try to run using the tiny-yolo-voc.weights my program works and the FPS fluctuates between 5 and 6 seconds but the video doesn't show.

Help anyone?

Most helpful comment

I see this error on yolov2-tiny.weights, but not on yolov2.weights, so I modified loader.py line 121 as follows to fix the problem:

if 'tiny' in path:
    self.offset = 20
else:
    self.offset = 16

All 6 comments

IIRC you can modify 'offset' in loader.py (line 121), change it to 20 as a work around.

@leyjere I already tried setting the offset to 20 and 16 but the terminal still gives me an error

I see this error on yolov2-tiny.weights, but not on yolov2.weights, so I modified loader.py line 121 as follows to fix the problem:

if 'tiny' in path:
    self.offset = 20
else:
    self.offset = 16

Once you change the self.offset value, you have to reinstall darkflow

Once you change the self.offset value, you have to reinstall darkflow

how to reinstall it?

Just re-execute the installation command lines again

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1NNcoder picture 1NNcoder  路  3Comments

pribadihcr picture pribadihcr  路  5Comments

humanova picture humanova  路  4Comments

bareblackfoot picture bareblackfoot  路  4Comments

halt9 picture halt9  路  3Comments