Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: Save or restore weights that is not an instance of tf.Variable is not supported in h5, use save_format='tf' instead. Got a model or layer Conv2D with weights [<KerasVariable shape=(7, 7, 3, 64), dtype=float32, path=conv1/kernel>, <KerasVariable shape=(64,), dtype=float32, path=conv1/bias>] #3021

Open
saakshi-pathania opened this issue Feb 28, 2024 · 4 comments

Comments

@saakshi-pathania
Copy link

I am a Newbie to object detection. I am trying to use the saved model for object detection in a video but I am getting the following error-
NotImplementedError: Save or restore weights that is not an instance of tf.Variable is not supported in h5, use save_format='tf' instead. Got a model or layer Conv2D with weights [<KerasVariable shape=(7, 7, 3, 64), dtype=float32, path=conv1/kernel>, ]

Can you please help me out?

@LorenzoCorradi
Copy link

Same probleme here, did you find a workaround?

@Soujanya-S6
Copy link

Hey, were you able to resolve this?

@kumbarisagar3011
Copy link

did you solve this?

@Hanysabeh
Copy link

Same problem here, Dears, did you find a workaround?

Traceback (most recent call last):
model.load_weights(weights_path, by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])
File "/home/hany/Desktop/Traffic/Mask-R-CNN-using-Tensorflow2/mrcnn/model.py", line 2102, in load_weights
hdf5_format.load_weights_from_hdf5_group_by_name(f, layers)
python3.12/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 766, in load_weights_from_hdf5_group_by_name
symbolic_weights = _legacy_weights(layer)
^^^^^^^^^^^^^^^^^^^^^^
python3.12/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 895, in _legacy_weights
raise NotImplementedError(
NotImplementedError: Save or restore weights that is not an instance of tf.Variable is not supported in h5, use save_format='tf' instead. Got a model or layer Conv2D with weights [<KerasVariable shape=(7, 7, 3, 64), dtype=float32, path=conv1/kernel>, ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants