TensorFlow2.0-Examples icon indicating copy to clipboard operation
TensorFlow2.0-Examples copied to clipboard

AssertionError: failed to read all data

Open ytolochko opened this issue 6 years ago • 5 comments

Hello, thank you for this YOLO implementation, it's quite impressive. As I'm working through it I ran into a problem. I downloaded the weights as instructed, they are in the directory where image_demo.py is, but when executing the image_demo.py I get the following error from utils.load_weights :

assert len(wf.read()) == 0, 'failed to read all data' AssertionError: failed to read all data

Can you please give me a hint how to resolve it? It seems like the weights are not read correctly. I am on windows 10 if that matters.

ytolochko avatar Aug 02 '19 23:08 ytolochko

It works fine on both Mac and Linux. sorry I have no idea about it.

YunYang1994 avatar Aug 03 '19 02:08 YunYang1994

Thanks for the reply!

For those who are seeing this issue: just comment out the assert statement, it still works! The weights load correctly but for some reason the assert statement fails. image_demo.py still produces the expected result

ytolochko avatar Aug 03 '19 09:08 ytolochko

Hmmm, I'm getting the same issue. Except when I comment out the assert statement, I get the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 5577 values, but the requested shape requires a multiple of 85 [[node Reshape_5 (defined at /PycharmProjects/conduct/YOLOV3/video_demo.py:51) ]] [Op:__inference_keras_scratch_graph_13283]

Any ideas?

SinclairHudson avatar Aug 04 '19 17:08 SinclairHudson

Just figured out what went wrong. In video_demo.py, you have to change the number of classess manually, on line 24. Could this be changed so that it automatically reads the classes file from the config and determines the number of classes?

SinclairHudson avatar Aug 04 '19 17:08 SinclairHudson

You need have the original number of coco classes to load the model. this happened to me when i changed the classes from the config to run yymnist training classes.

HarrisDePerceptron avatar Apr 28 '20 19:04 HarrisDePerceptron