Keras-yolo3: When I run train.py, it shows "Skipping loading of weights for layer conv2d_67 due to mismatch in shape"

Created on 9 Jun 2018  路  6Comments  路  Source: qqwweee/keras-yolo3

/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((1, 1, 1024, 75) vs (255, 1024, 1, 1)).
weight_values[i].shape))
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_59 due to mismatch in shape ((75,) vs (255,)).
weight_values[i].shape))
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((1, 1, 512, 75) vs (255, 512, 1, 1)).
weight_values[i].shape))
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_67 due to mismatch in shape ((75,) vs (255,)).
weight_values[i].shape))
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((1, 1, 256, 75) vs (255, 256, 1, 1)).
weight_values[i].shape))
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:1009: UserWarning: Skipping loading of weights for layer conv2d_75 due to mismatch in shape ((75,) vs (255,)).
weight_values[i].shape))

I am wondering if it matters the whole networks design?

Most helpful comment

These layers are the three output layers of the yolo network. You probably got the message because you changed the number of classes and therefore the shape of the last conv layers will change aswell. So you can just ignore the message, the network will work just fine.

All 6 comments

These layers are the three output layers of the yolo network. You probably got the message because you changed the number of classes and therefore the shape of the last conv layers will change aswell. So you can just ignore the message, the network will work just fine.

Hi, did you have solved the problem yet? I run the train.py with the voc dateset and I met the same issue. what's worse,I got the MemoryError following:
train(model, image_data/255., y_true, log_dir=log_dir)
MemoryError

@18814181500 stefanbo92 is right. The pretrained yolo.h5 is trained on coco and the final output is (80 coco classes + 5) *3 =255 according to the paper. The output of VOC is ( 20 voc classes + 5) *3 =75.

Im getting the below error when I tried using trained_weights_final.h5 on yolo.py to try the model on a sample image. Im thinking this is due to mismatch as the above issues. I trained it with VOC2007_train.txt

ValueError: Dimension 0 in both shapes must be equal, but are 1 and 75. Shapes are [1,1,1024,255] and [75,1024,1,1]. for 'Assign_360' (op: 'Assign') with input shapes: [1,1,1024,255], [75,1024,1,1].

I am wondering how I might solve, does any one know how?

I think you also need to change the following line:
self.classes_path = 'model_data/coco_classes.txt'
to the classes you trained on.

Hi @stefanbo92 , do you know why the shape after 'vs' is (255, 256, 1, 1) instead of (1, 1, 256, 255)?

Was this page helpful?
0 / 5 - 0 ratings