Closed lidorshimoni closed 3 years ago
even with new and unchanged yolov4.weights and coco.names files, it raises the same exception.
Can you share your script?
I'm getting the same error with yolov4 and yolov4-tiny. I'm using the "tutorial" script present on the documentation page.
from yolov4.tf import YOLOv4
yolo = YOLOv4()
# yolo = YOLOv4(tiny=True)
yolo.classes = "coco.names"
yolo.input_size = (640, 480)
yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")
# yolo.load_weights("yolov4-tiny.weights", weights_type="yolo")
yolo.inference(media_path="kite.jpg")
yolo.inference(media_path="road.mp4", is_image=False)
is it?
Yes. I did a little investigation and at some point the length of the data read from the weights file is different from the count (darknet shape product).
Check version.
python3 -m pip show yolov4
Name: yolov4
Version: 2.0.0
...
And try this.
from yolov4.tf import YOLOv4
yolo = YOLOv4(tiny=True)
yolo.classes = "coco.names"
assert(len(yolo.classes) == 80)
yolo.input_size = (640, 480)
yolo.make_model()
yolo.load_weights("yolov4-tiny.weights", weights_type="yolo")
yolo.inference("kite.jpg")
Problem solved, thanks. The error was in my coco.names file.
@lidorshimoni Closed because there is no answer for a long time.
I'm suddenly getting this error... but it worked for me before with the same weights file. using yolov4-tiny
ValueError: Model and weights file do not match.