Darkflow: AssertionError: expect 64701556 bytes, found 180357512

Created on 12 May 2017  ·  27Comments  ·  Source: thtrieu/darkflow

Apologise if this is not an issue and rather me! I get the following error when I run this command:
./flow --model cfg/tiny-yolo.cfg --load bin/yolo-tiny.weights

/Users/localadmin/Downloads/darkflow-master/darkflow/dark/darknet.py:54: UserWarning: ./cfg/yolo-tiny.cfg not found, use cfg/tiny-yolo.cfg instead
cfg_path, FLAGS.model))
Parsing cfg/tiny-yolo.cfg
Loading bin/yolo-tiny.weights ...
Traceback (most recent call last):
File "./flow", line 45, in
tfnet = TFNet(FLAGS)
File "/Users/localadmin/Downloads/darkflow-master/darkflow/net/build.py", line 55, in __init__
darknet = Darknet(FLAGS)
File "/Users/localadmin/Downloads/darkflow-master/darkflow/dark/darknet.py", line 27, in __init__
self.load_weights()
File "/Users/localadmin/Downloads/darkflow-master/darkflow/dark/darknet.py", line 82, in load_weights
wgts_loader = loader.create_loader(args)
File "/Users/localadmin/Downloads/darkflow-master/darkflow/utils/loader.py", line 105, in create_loader
return load_type(path, cfg)
File "/Users/localadmin/Downloads/darkflow-master/darkflow/utils/loader.py", line 19, in __init__
self.load(
args)
File "/Users/localadmin/Downloads/darkflow-master/darkflow/utils/loader.py", line 77, in load
walker.offset, walker.size)
AssertionError: expect 64701556 bytes, found 180357512

Also, as I'm new to machine learning would you point to me any good article on how to create new cfg file and how to generate weight file from scratch, I can't find this online!

Most helpful comment

Hey @conjuringjha , I had the same issue but I solved it by just substracting the found value (in your case 180357512) to the expected value (in your case 64701556). Let Assume the result is "X".
Now open your file ./darkflow/utils/loader.py and find the line 121. Then you will see a variable "self.offset" with a certain value assigned (16 or 20). Let suppose that value equals "Y".
Upadte the value of self.offset=Y+X

I hope this will help you !

All 27 comments

It seems that there is an inconsistency between your .cfg file .weigths file.Try loading different weights or different configuration.

Try this one:
./flow --model ./cfg/tiny-yolo-voc.cfg --load ./bin/tiny-yolo-voc.weights ...

Thanks guys, I will try your suggestion at the end of this week - I'll let you know how it goes.

There seems to be a lot of confusion regarding the correspondence between .cfg and .weights file, whenever darknet updates new configs and discard old ones as well as their binary .weights. The stable configs that I know use .cfg in this repo and .weights uploaded in the google drive (see README).

@thtrieu, in the below link click here [google drive], where you have uploaded the weights, I am not able to get the corresponding .cfg file for yolo-tiny.weights. The one present in cfg/tiny-yolo.cfg doesn't work with that. I am getting the same error as mentioned in this thread.
Would appreciate your help!
Thanks!

I've the same error, has anyone solved it??
Thanks!

I've solve!!!
Download from here the .cfg and .weights file!!!

I've the same error too, has anyone solved it??

Yes, I solved it, you must download from here the .cfg and .weights file!!!
Modify your .cfg file in cfg folder

I still have an error. Downloaded the files for tiny yolo(both cfg and weights), changed the config to run with 3 classes and added the class names to labels.txt. I get the error AssertionError: Over-read ./tiny-yolo.weights. How do I get around this? Thanks in advance!

pay attention, I've use cocos.name to fill label.txt
@goodhamgupta see this issue #80

The problem still exists. Unfortunately, the model and the weight are not suitable for each other. I tried to download it from the site https://pjreddie.com/darknet/yolo/ Tiny YOLO based on COCO trainval.
The suggested solution from @evgkarasev - pick another model & weight based on VOC 2007+2012 does work for me

I was running into this "AssertionError" as well. From my understanding it happens when you change the cfg file (i.e. the class number) and use weights that were created for the original cfg file. This is why you get the different bits when running flow.

The mistake I was making was I rewrote the original cfg file with my new classes and filter numbers. In the darkflow read me it mentions "It is crucial that you leave the original tiny-yolo-voc.cfg".

So what I did since i was working with 2 class i copied the tiny-yolo-voc.cfg file and renamed it tiny-yolo-voc-2c.cfg and made the changes to class and filter in this new copy. Then when I came to train with flow i referenced the copy after --model and it worked for me.

When it starts to train I notice it references both cfg files when parsing.

Hope this helps.

@mkuko Can you tell the command

@deepkshikha
Sure,

flow --model cfg/tiny-yolo-voc-2c.cfg --load bin/tiny-yolo-voc.weights --train --annotation (path to my annotations folder) --dateset (path to my images folder)

I run this command with both tiny-yolo-voc.cfg (the original file) and tiny-yolo-voc-2c.cfg in the cfg folder.

@mkuko Thanks
I followed the instruction left the cfg file unchanged and created a new cfg by changing the number of class and filter number still not working for me. Is there anything else you did??

@deepkshikha
I don't believe that I did anything else to fix this issue.

Maybe I or someone else here can help, can you post the command your entering and the error your getting?

@thtrieu as per your suggestion, I paired weights mentioned in the drive with the corresponding .cfg files in repo but I get the AssertionError: expect 64701556 bytes, found 180357512. Before that I tried the (freshly downloaded/ updated) weights and .cfg pairs from the official site but I happened upon the same error.

I used the basic flow command, the one with no changes in the .cfg file or label.txt.

Is there any weight-cfg pair in the world that is still working...???

Hey @conjuringjha , I had the same issue but I solved it by just substracting the found value (in your case 180357512) to the expected value (in your case 64701556). Let Assume the result is "X".
Now open your file ./darkflow/utils/loader.py and find the line 121. Then you will see a variable "self.offset" with a certain value assigned (16 or 20). Let suppose that value equals "Y".
Upadte the value of self.offset=Y+X

I hope this will help you !

Hello;

The proposal of @ThierryBayala solved my issue; Thank you very much.

i had:

AssertionError: expect 63102556 bytes, found 63471556

i made 63471556-63102556=369000

then i chaned line 121 to: self.offset=Y+369000

@ThierryBayala Thank you very much. It resolved my issue too.

Hi,
I installed the Darkflow globally and I have no clue where can I find the " ./darkflow/utils/loader.py"
same time I can not find such a folder in the recent "darkflow" clone.
I know the problem is the cfg and weight file which is not matching, because after trying several CFGs and WEIGHTs then I found the proper match.
BUT BUT I wonder how? while the CFG and Weight I used in the first place were from the "https://pjreddie.com/darknet/" which they provided originally.
Then, where is the problem?!
@ThierryBayala
@KHDOUDI
@ambr89

@Ata1362 I read somewhere that the weights on pjreddie.com are being continuously trained which causes the mismatch with the CFG files.

Thank you,
So how can we find the mismatch between the CFG and Weights file and fix it?
We can not wait until someone accidentally or after matching many CFG's,
finds the proper one and shares with us.

On Sun, May 12, 2019 at 8:46 PM Matt P notifications@github.com wrote:

@Ata1362 https://github.com/Ata1362 I read somewhere that the weights
on pjreddie.com are being continuously trained which causes the mismatch
with the CFG files.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/thtrieu/darkflow/issues/223#issuecomment-491592661,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKAIFQNP5URQYAO6FDLY2FTPVAGTPANCNFSM4DLF6APQ
.

@Ata1362 I was using the tiny-yolo-voc from his website, which ran properly with the tiny-yolo-voc he posted here: https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU

Hey @conjuringjha , I had the same issue but I solved it by just substracting the found value (in your case 180357512) to the expected value (in your case 64701556). Let Assume the result is "X".
Now open your file ./darkflow/utils/loader.py and find the line 121. Then you will see a variable "self.offset" with a certain value assigned (16 or 20). Let suppose that value equals "Y".
Upadte the value of self.offset=Y+X

I hope this will help you !

This works for me too!!!!!!!!!!

Thanks @ThierryBayala,

This works for me as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jubjamie picture jubjamie  ·  4Comments

ManojPabani picture ManojPabani  ·  4Comments

humanova picture humanova  ·  4Comments

borasy picture borasy  ·  3Comments

ma3252788 picture ma3252788  ·  3Comments