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

expect 202355760 bytes, found 203934260 #900

Open maliifat opened 5 years ago

maliifat commented 5 years ago

C:\Users\BFOSS\Desktop\darkflow-master>python flow --model cfg/yolov2.cfg --load bin/yolov2.weights --train --annotation new_model_data/annotations --dataset new_model_data/images --gpu 0.8 --epoch 300

Parsing ./cfg/yolov2.cfg Parsing cfg/yolov2.cfg Loading bin/yolov2.weights ... Traceback (most recent call last): File "flow", line 6, in cliHandler(sys.argv) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\cli.py", line 26, in cliHandler tfnet = TFNet(FLAGS) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\net\build.py", line 58, in init darknet = Darknet(FLAGS) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\dark\darknet.py", line 27, in init self.load_weights() File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\dark\darknet.py", line 82, in load_weights wgts_loader = loader.create_loader(args) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\utils\loader.py", line 105, in create_loader return load_type(path, cfg) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\utils\loader.py", line 19, in init self.load(args) File "C:\Users\BFOSS\Desktop\darkflow-master\darkflow\utils\loader.py", line 77, in load walker.offset, walker.size) AssertionError: expect 202355760 bytes, found 203934260

how can I solve it ?

yizhou-wang commented 5 years ago

I got a similar error.

AssertionError: expect 202417260 bytes, found 202417264

This issue #802 also mentioned this error.

dudqls1994 commented 5 years ago

did you change label? I also have this error

abhishek-s-jha commented 5 years ago

This error arises because of mismatch of configuration file and loaded weight. Simple way to solve this is to edit self.offset value in loader.py present at darkflow/darkflow/utils/

updated self.offset = old_offset_value + (found_value - expected_value)

And also check that number of classes in cfg file is equal to the number of labels present in labels.txt

seek-ing commented 5 years ago

1、首先,我们在ubuntu下先用anaconda2(版本是2还是3不影响)安装了tensorflow. 2、darkflow要求的安装环境是Python3,那么把anaconda2里的Python2升级到python3.5就行,Ubuntu系统默认是自带python2.7的,在使用darkflow时,用source activate py35进入Python3.5环境再使用flow命令就行。 3、接下来,你可以在任何地方安装darkflow,但是要在py35环境下安装,换Python环境source activate py35,然后安装好你会看到darkflow的文件夹,这个文件夹没用,在安装darkflow的时候会自动拷贝到anaconda2/envs/py34/lib/python3.5/site-packages/darkflow/utils(我Python3.5命名的时候手抖,弄成了py34),要改的是上述目录下loader.py第121行,把self.offset = 16改成self.offset = 20

me6ran commented 5 years ago

@abhishek795jha I got the same error, and changed the self.offset to the calculated number, I can confirm that the error got disappeared, but after training I saw that the model is way off and cannot detect the trained object at all. so I found that this solution is not gonna work. any experience guys?

shalin51 commented 5 years ago

@abhishek795jha I got the same error, and changed the self.offset to the calculated number, I can confirm that the error got disappeared, but after training I saw that the model is way off and cannot detect the trained object at all. so I found that this solution is not gonna work. any experience guys?

I had same problem. My calculated value was 820820 and it didn't detect anything.

I changed back classes to same number (in my case it was 80) and downloaded 80 labels. after that the calculated number was 4 and it started detecting.

I didn't have the time to exactly calculate the bytes, but from my experience I can say that it depends on number of filters.

hakS07 commented 5 years ago

@shalin51 Hi,i want to ask if you solve this problem because i have exactly the same problem as you updated self.offset = old_offset_value + (found_value - expected_value)=16+769504=769520 and the calasses=5 filtres=50=5(5+5) AssertionError: expect 44179096 bytes, found 44948600 but i stil have the same pb any help

abhishek-s-jha commented 5 years ago

@me6ran Didn't happen with my training. Can you describe your data and hyperparameter, if possible

Rockstar256 commented 5 years ago

I don't know whether it's a good idea or not. But it works if you comment out that assert statement.

540ul4rm6 commented 5 years ago

abhishek795jha is right! I solved the problem. http://tn00343140a.pixnet.net/blog/post/299895872-YOLO%E9%81%8B%E8%A1%8Cdarkflow%E6%99%82,%20%E5%87%BA%E7%8F%BEAssertionError:%20expect%20203929404%20bytes,%20found%20203934260

DigvijaySingh7720 commented 4 years ago

Error :- AssertionError: expect 63184556 bytes, found 63184560

Solution : " ./darkflow/utils/loader.py" at line 121, you will find self.offset= 16 or 20. update to be done : - found 63184560 - expect 63184556 = 4, then add 4 to self.offset = add this 4 (or any other value) diff to 16 or 20 and then run your command again.

Best of Luck, it work for me, hope it may work for you as well, keep helping other.