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: Over-read bin/yolo2-voc.weights #372

Open tankienleong opened 7 years ago

tankienleong commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

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

razmik commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

hsgaurav commented 6 years ago

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

JoffreyN commented 6 years ago

@razmik but where is the .cfg?

adithya-tp commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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?