Hello @MGriff
Issues with your notebook
-
in creating preprocessing function, where you def augment images(image, label),
while you normalize the pixel values, you used true division // but you are suppose to /
Next in the same grader cell you need to define function to take label as well using tf.one_hot, also remember instead of using num_classes use the value of num_classes -
Create a function to generate the saliency map
def do_salience(image, model, label, prefix):
img_file=image (THIS CODE IS NOT REQUIRED) -
in def do_salience
Define the expected output array by one-hot encoding the label
The length of the array is equal to the number of classes
This code is incorrect, you need to use image call function where you add an additional dimension for the batch, i.e. img_new_dim.shape[0] to the label. Also using here num_classes is correct. Also this would be called expected_output rather than label_one_hot. Please replace the same in the loss recall function for expected_output.
-
generate the saliency maps for the 5 test images
using label as label[0] is incorrect, you are only suppose to use 0 or 1 based on instruction Cats will have the label0
while dogs will have the label1
. -
Configure the model for training,
incorrect loss loss=‘sparse_categorical_crossentropy’,
“categorical” will be 2D one-hot encoded labels, “binary” will be 1D binary labels, “sparse” will be 1D integer labels, so guess which loss would be correct one? Extra hint in instructions: normalize the pixel values to [0, 1]
incorrect optimizer=tf.keras.optimizers.experimental.RMSprop, kindly use tf.keras.optimizers.RMSprop
Let me know once your issue is resolved.
Regards
DP