Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: Over-read bin/yolo2-voc.weights #372

Open
tankienleong opened this issue Aug 10, 2017 · 12 comments
Open

AssertionError: Over-read bin/yolo2-voc.weights #372

tankienleong opened this issue Aug 10, 2017 · 12 comments

Comments

@tankienleong
Copy link

I tried to run the yolo-voc.cfg with the weights file downloaded from https://pjreddie.com/darknet/yolo/ but it shows the following error:

ubuntu@ubuntu-S2600CW:~/Desktop/virtualroiflow/darkflow$ ./flow --model cfg/yolo2-voc.cfg --load bin/yolo2-voc.weights --train --dataset "VOCdevkit/VOC2007/JPEGImages/" --annotation "VOCdevkit/VOC2007/Annotations/" --gpu 1.0

Parsing ./cfg/yolo2-voc.cfg
Parsing cfg/yolo2-voc.cfg
Loading bin/yolo2-voc.weights ...
Traceback (most recent call last):
File "./flow", line 6, in
cliHandler(sys.argv)
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/cli.py", line 24, in cliHandler
tfnet = TFNet(FLAGS)
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/net/build.py", line 58, in init
darknet = Darknet(FLAGS) # Initialize darknet: parse cfg file, load weight
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/dark/darknet.py", line 27, in init
self.load_weights()
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/dark/darknet.py", line 85, in load_weights
wgts_loader = loader.create_loader(*args)
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/utils/loader.py", line 106, in create_loader
return load_type(path, cfg)
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/utils/loader.py", line 20, in init
self.load(*args)
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/utils/loader.py", line 70, in load
val = walker.walk(new.wsize[par])
File "/home/ubuntu/Desktop/virtualroiflow/darkflow/darkflow/utils/loader.py", line 128, in walk
'Over-read {}'.format(self.path)
AssertionError: Over-read bin/yolo2-voc.weights

@jameskcentrum
Copy link

Hi, try it again, but follow instructions in readme and use weights uploaded on google drive only, the ones from darknet are not working with darkflow cfgs now.

@tankienleong
Copy link
Author

Hi @jameskcentrum , the weights file uploaded on google drive for yolov2 is trained on coco dataset. Do you have any idea where I can get the weights file for yolov2 that trained on PASCAL VOC dataset?

@ysyyork
Copy link

ysyyork commented Oct 2, 2017

I got the same problem and I also wanna find the pascal VOC pretrained weights file. Anyone can help?

@razmik
Copy link

razmik commented Nov 23, 2017

As the files on official YOLO always updated, need to have the .weights corresponding to .cfg. Thanks to this .weights folder I was able to get it fixed.

Further details are in this closed issue - #153

@Irtza
Copy link

Irtza commented Nov 28, 2017

I've used the weights from the repo by pjreaddie, I am able to obtain results using :
flow --model cfg/tiny-yolo.cfg --load bin/tiny-yolo-voc.weights

everything works fine, but when try to import TFNET I can't load the wieights:

options = {"model": "/path/to/darkflow/cfg/tiny-yolo.cfg", "load": "/path/to/darkflow/bin/tiny-yolo-voc.weights", "threshold": 0.1}
tfnet = TFNet(options)

I get :
AssertionError: Over-read /path/to/bin/tiny-yolo-voc.weights

@junxuezheng
Copy link

@razmik
Hi'
Do you know where could i get the right yolo-voc.weights about yolo-voc.cfg

@hsgaurav
Copy link

getting the same error
AssertionError: Over-read /path/to/bin/tiny-yolo-voc.weights
can anyone help please

@JoffreyN
Copy link

JoffreyN commented Aug 3, 2018

@razmik but where is the .cfg?

@adithya-tp
Copy link

Try downloading the tiny yolo voc cfg and weigts files from the following url
https://pjreddie.com/darknet/yolov2/. The files from this website solved my problem.

This is different from https://pjreddie.com/darknet/yolo/ .

If you get an assertion error after that, something that looks like the following
AssertionError : expect 63082056 bytes, found 63471556

The following is the solution to that problem
Go to the darkflow folder within your darkflow directory.
Open up loader.py in the utils folder.

Go to the line of code in the class class weights_walker(object)

You will see a line that says self.offset = some value X (probably 16 or 20)
You've gotta replace this self.offset value with ( X + (found - expected) )

This solved the bytes error for me.

@iseegr8tfuldeadppl
Copy link

It seems that the PJ Reddie files are not fully compatible, so I have to download the pre built weights from the provided link in the README: https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

@Sumitksh
Copy link

Hello, i have been trying to train my own data set having xml files for each image from scratch , but i have been recieving
'Over-read {}'.format(self.path) AssertionError: Over-read /darkflow/weights/yolo.weights error. I tried using others weights with there corresponding cfg files, yet i am getting the same error in every case.

@absognety
Copy link

Hi, try it again, but follow instructions in readme and use weights uploaded on google drive only, the ones from darknet are not working with darkflow cfgs now.

Could you pinpoint the exact compatible pairs of cfg and weights files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests