C3W4 Assignemnt Cats vs Dogs Saliency Maps : Stuck at 0.87 average structural similarity

Title: C3W4 Saliency Maps Assignment - Consistently getting ~0.87 SSIM instead of the expected ~0.95

Hi everyone,

I’m working on the C3W4 Cats vs Dogs Saliency Maps assignment in the Advanced Computer Vision with TensorFlow course, and I’m stuck on the grader.

The grader reports:

Your images achieved an average structural similarity index of 0.87. At least 0.88 is required to pass.

Per-image scores:

  • salientcat1.jpg: 0.85

  • salientcat2.jpg: 0.86

  • salientcatanddog.jpg: 0.90

  • salientdog1.jpg: 0.87

  • salientdog2.jpg: 0.85

According to the notebook instructions, the expected average should be around 0.95, so I believe something in my implementation is still incorrect.

Here’s what I’ve already verified:

  • The model architecture matches the notebook.

  • I load the provided 15_epochs.h5 weights before training.

  • I train for exactly 3 additional epochs.

  • I’m using RMSprop(learning_rate=0.001) and sparse_categorical_crossentropy as specified.

  • Images are converted from BGR to RGB, resized to 300×300, and normalized by dividing by 255.0.

  • The saliency function uses GradientTape, tf.one_hot, categorical_crossentropy, tf.reduce_max(tf.abs(gradient), axis=-1), and min-max normalization exactly as described.

Could someone point out any common mistakes that typically lead to SSIM values around 0.87 instead of the expected 0.95? If needed, I can also share my notebook or the graded cells.

Thanks!

The most common issue when trying to achieve structural similarity is related to the model itself, especially in the dog vs. cat classifier.

Make sure you are building the model correctly. Let me give you a hint: the expected architecture should have four blocks of layers in the output structure.

Check your implementation carefully with the expected output—do you see the correct number of layers, the right types of layers, and the expected number of parameters?

Also, make sure you are following the steps in the correct order when adding code into functions and not skipping or mixing them. Use these as guiding clues to compare your model against the expected design and identify where it might be diverging.

Thank you alot, the issue was the structure of the model. I had an extra MaxPooling Layer before global Averge pooling. and i was obsessing over salience fucntion and the preprocessing pipline and was overlooking the structure becuase of the sequence one Conv2D and followed by Maxpooling.