qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.44k forks source link

ValueError: You are trying to load a weight file containing 37 layers into a model with 147 layers. #648

Open fadili101 opened 4 years ago

fadili101 commented 4 years ago

I created a new model based on tiny yolo v3 but with some modifications. and I converted this model to keras but when I tried to test my model the program gave me this problem During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "yolo_video.py", line 75, in detect_video(YOLO(**vars(FLAGS)), FLAGS.input, FLAGS.output) File "/home/cc/Documents/keras project/keras-yolo3-master/yolo.py", line 45, in init self.boxes, self.scores, self.classes = self.generate() File "/home/cc/Documents/keras project/keras-yolo3-master/yolo.py", line 74, in generate self.yolo_model.load_weights(self.model_path) # make sure model, anchors and classes match File "/home/cc/OpenCV-master-py3/lib/python3.6/site-packages/keras/engine/topology.py", line 2656, in load_weights f, self.layers, reshape=reshape) File "/home/cc/OpenCV-master-py3/lib/python3.6/site-packages/keras/engine/topology.py", line 3354, in load_weights_from_hdf5_group str(len(filtered_layers)) + ' layers.') ValueError: You are trying to load a weight file containing 37 layers into a model with 147 layers.