matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.48k stars 11.68k forks source link

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 5 months ago

saakshi-pathania commented 5 months ago

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 commented 3 months ago

Same probleme here, did you find a workaround?

Soujanya-S6 commented 3 months ago

Hey, were you able to resolve this?

kumbarisagar3011 commented 2 months ago

did you solve this?

Hanysabeh commented 4 weeks ago

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>, ]