I am having an issue with the final step of the birdbox assignment. My model runs, I am able to classify and localize birds in each image, and I get IOUs and am able to save it to temp_model.h5. However, the final step, when I try to save it as ‘birds.h5’, I receive the following error. Any thoughts?
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-21180693577e> in <cell line: 2>()
1 # Load the model you saved earlier
----> 2 model = tf.keras.models.load_model("temp_model.h5", compile=False)
3
4 # Re-save the model with the compatible TF version
5 model.save("birds.h5")
1 frames
/usr/local/lib/python3.10/dist-packages/keras/engine/input_layer.py in __init__(self, input_shape, batch_size, dtype, input_tensor, sparse, name, ragged, type_spec, **kwargs)
134 input_shape = batch_input_shape[1:]
135 if kwargs:
--> 136 raise ValueError(f'Unrecognized keyword arguments: {list(kwargs.keys())}')
137
138 if sparse and ragged:
ValueError: Unrecognized keyword arguments: ['batch_shape']
first check which version of the tf is your notebook using, then in the same assignment as per instructed in the post, you need to use the tf version which is compatible to run the codes.
If you are using an updated assignment chances are the code cell might be already added.
Hi Deepti and Rahul! Thank you for reporting! The notebook is now patched in the public repo. Learners can reload the Colab from the classroom to see the changes. Another way is to add these two lines at the top of the existing notebook, then run all the cells again until you generate a new model file: