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

yolov3.weights loading error

Open Shank2358 opened this issue 5 years ago • 5 comments

I ran the image_demo.py, when loading the weights file, an error occurred in the row utils.load_weights(model, "yolov3.weights")

The error:

File "D:/YOLOV3/image_demo.py", line 40, in utils.load_weights(model, "yolov3.weights") File "D:\YOLOV3\core\utils.py", line 59, in load_weights assert len(wf.read()) == 0, 'failed to read all data'

Shank2358 avatar Dec 29 '19 08:12 Shank2358

I ran the image_demo.py, when loading the weights file, an error occurred in the row utils.load_weights(model, "yolov3.weights")

The error:

File "D:/YOLOV3/image_demo.py", line 40, in utils.load_weights(model, "yolov3.weights") File "D:\YOLOV3\core\utils.py", line 59, in load_weights assert len(wf.read()) == 0, 'failed to read all data'

I also have this problem. Do you solve it?

Ebimsv avatar Apr 15 '20 09:04 Ebimsv

I ran the image_demo.py, when loading the weights file, an error occurred in the row utils.load_weights(model, "yolov3.weights")

The error:

File "D:/YOLOV3/image_demo.py", line 40, in utils.load_weights(model, "yolov3.weights") File "D:\YOLOV3\core\utils.py", line 59, in load_weights assert len(wf.read()) == 0, 'failed to read all data'

Try to reload weights.

querion avatar Jun 04 '20 06:06 querion

before assert to sleep(4)

Mr-yun avatar Jun 30 '20 14:06 Mr-yun

When it happened to me I had config __C.YOLO.CLASSES = "./data/classes/yymnist.names" instead of __C.YOLO.CLASSES = "./data/classes/coco.names" in core.config.py

kiansierra avatar Jul 16 '20 12:07 kiansierra

I use this code in Tensorflow 2.2 and Keras 2.2.4 and it works properly.

Use this command for saving weights:

 model.save_weights("{model_name}.ckpt")

Then load model using:

 model.load_weights("{model_name}.ckpt")

Instead of:

 utils.load_weights(model, "/yolov3")

You should specify your "model_name"!

Good luck!

tranleanh avatar Mar 12 '21 13:03 tranleanh