Is this a bug?
itsmebabysmiley opened this issue · comments
First, I try to create the model
base_model = create_model(weights="imagenet")
output:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-4-6e62a586cf6e>](https://localhost:8080/#) in <module>
----> 1 base_model = create_model(weights="imagenet")
3 frames
[/usr/local/lib/python3.7/dist-packages/keras/saving/hdf5_format.py](https://localhost:8080/#) in load_weights_from_hdf5_group_by_name(f, model, skip_mismatch)
842 continue
843 raise ValueError(
--> 844 f'Shape mismatch in layer #{k} (named {layer.name}) for weight '
845 f'{symbolic_weights[i].name}. '
846 f'Weight expects shape {expected_shape}. Received saved weight '
ValueError: Shape mismatch in layer #1 (named conv2d_1) for weight conv2d_1/kernel:0. Weight expects shape (3, 3, 32, 32). Received saved weight with shape (32, 3, 3, 3)
After, I run it again without restart runtime.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-5-6e62a586cf6e>](https://localhost:8080/#) in <module>
----> 1 base_model = create_model(weights="imagenet")
3 frames
[/usr/local/lib/python3.7/dist-packages/keras/saving/hdf5_format.py](https://localhost:8080/#) in load_weights_from_hdf5_group_by_name(f, model, skip_mismatch)
842 continue
843 raise ValueError(
--> 844 f'Shape mismatch in layer #{k} (named {layer.name}) for weight '
845 f'{symbolic_weights[i].name}. '
846 f'Weight expects shape {expected_shape}. Received saved weight '
ValueError: Shape mismatch in layer #479 (named conv2d_149) for weight conv2d_149/kernel:0. Weight expects shape (3, 3, 3, 32). Received saved weight with shape (256, 1536, 1, 1)
Then, I run it again. There is no error occur again. Is it suppose to raise an error for shape mismatch or something?