C3W4 assignment: cannot get the required 0.95 accuracy

Hi,

I have difficulties reaching the desired 0.95 accuracy for C3W4 assignment. I have searched the previous posts and have checked my code for loss function, optimizer, etc. But still could not figure out why. Here is my loss function:

{mentor edit: code removed}

Any help would be highly appreciated!

1 Like

Please do not post your code on the forum. That is not allowed by the Code of Conduct.

Perhaps a mentor for this course will be able to provide some guidance.

1 Like

Well, where do you think could be the issue?

1 Like

Hi Gent,

Could I get a hint? I really could not figure out which part of the code goes wrong. Thanks!

1 Like

Hi Gent,

I sent a copy of my assignment to you via DM. Could you take a look? Many thanks!

1 Like

Hello Yan,

I saw your code which seems to be alright, the only thing is this line:

Add an additional dimension (for the batch), and save this in a new variable

can you try to use a new named variable here! and let us know the result!

1 Like

Hi Gent,

Thanks for your reply!

After I use a new variable, the accuracy is still 0.91. Is there any other suggested solution? Thanks!

1 Like

Hmm, my eye did not catch any other issues. On gradient tape loop you have to use the new variable not img anymore!

Maybe go through the assignment from scratch again you might catch a mistake somewhere!

1 Like

Hi, try to use fallback runtime:

1 Like

Hello Yan_Du,

  1. You did not define function that could taken on label, you only did for image.
    Please define label using tf.one_hot function in the def augment image. grader cell.

  2. The below statement is an optional steps but if you are not getting the desired accuracy, I would suggest you to explore this option but not mandatory.

optional: superimpose the saliency map with the original image, then display it.
we encourage you to do this to visualize your results better.

  1. For you model compile statement you loss choice is incorrect, it is not a multicategorial classification but only categorical classification with 2 class, so using sparse is incorrect.

Let me know if you are still stuck, sorry for the delay in response, not keeping well.

Also @Yan_Du kindly make sure once you do these correction, then follow the steps of fallback runtime and then run all the cells one by one, then submit your model for successful submission.

Regards
DP

2 Likes

Thank you!! The fallback runtime works!!

2 Likes

Hello @Yan_Du,

Do you mean without doing the correction the fallback runtime helping with the score??

I had sent you the same link to try first before reviewing your notebook.

Just let me know if that’s the case.

Regards
DP

1 Like