# Week 3 Assignment: Image Segmentation of Handwritten Digits - Model passed but unable to convert the model for submission

Week 3 Assignment: Image Segmentation of Handwritten Digits

model passed, IOU score is above expected average and grade is 75
Digit 0: IOU: 0.8213172648853966 Dice Score: 0.9018936796133392
Digit 1: IOU: 0.8376338830632087 Dice Score: 0.9116439251402253
Digit 2: IOU: 0.7630368088406994 Dice Score: 0.8655937357796188
Digit 3: IOU: 0.6886777502950472 Dice Score: 0.8156414095877331
Digit 4: IOU: 0.7690020428005909 Dice Score: 0.8694190557102437
Digit 5: IOU: 0.6884599691607177 Dice Score: 0.8154886485143386
Digit 6: IOU: 0.799865000787642 Dice Score: 0.8888055497913585
Digit 7: IOU: 0.7856809683169754 Dice Score: 0.879979102938515
Digit 8: IOU: 0.7235074617866822 Dice Score: 0.839575665122627
Digit 9: IOU: 0.7202521659255285 Dice Score: 0.8373797518668074

Grade is 75.9743331586249
You passed!

but unable to convert the model with older tensor for submission.

Load the model you saved earlier

model = tf.keras.models.load_model(“temp_model.h5”, compile=False)

Save the model with the compatible TF version

model.save(“final_model.h5”)


ValueError Traceback (most recent call last)
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 # Save the model with the compatible TF version
5 model.save(“final_model.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’]

Tried submitting without converting and grade fails with IOU error - There was a problem grading your submission. Check stderr for more details.

I am exactly facing the same issue with batch_shape. It apparently seems to be a bug in Colab or a version problem.

I researched solutions on the internet and the majority of them suggest upgrading TensorFlow.

thank you, i have reported issue and raise with coursera. lets see. there seems no way to solve this issue and pass the test yet.

Coursera doesn’t fix problems with the course materials. They just host a specific platform along with whatever content the course sponsor provides.

Note that the assignments are intended to run with the platform that Coursera provides. If you want to use a different version of the tools, you will encounter compatibility issues.

These are yours to resolve.

Hi @RafaelZimmermann

can you send me DM on how you recalled your input_shape?

Don’t post codes here.

Also, I hope you have run down all the cells till end which gives you on instruction about tf.version issue which when run down as per instructions solves the issue.

let me know if you still need help
regards
DP

1 Like

Hi! Thank you for reporting! Please check your inbox. There’s a recent update in Colab and would like to check how it might affect your solution.

1 Like

Hi everyone! There is indeed a problem with the TF version update on Colab. To get around it, please add a code cell up top and run these:

!pip install tensorflow==2.15.0 --quiet
!pip install keras==2.15.0 --quiet

That should work with the GPU available on Colab so you can train fast. You should run all the cells again until you generate a new model file.

Then you will need to downgrade to v2.8 (code is already in the notebook) in the last few cells for grader compatibility. This lower version is not compatible with Colab’s GPU so you will only use it for grading.

We’ll update the notebook and request updates to the grader, but hope this will suffice for now so you can get your grade asap. Thank you and sorry for the inconvenience!

3 Likes

thank you Chris, all good. it worked perfect with this new version. Grader could grade without any issues

2 Likes

Great! Glad it worked!

tks Chris

1 Like