TF1: C2_W2 Assignment: Help with grader output

Hello,

I need some help understanding the grader output. It says that my model failed the test case where training accuracy should be higher than validation accuracy and the difference should be less than 5%.

In the assignment however, the instructions say that the final validation accuracy should be higher than the train accuracy. In the notebook I submitted for grading, my model’s accuracy was 81% and validation accuracy was 84%, but I was failed by the grader. I think there is some discrepancy in the instructions and the grader’s test.

Another problem I faced with the grader output in the same notebook is that it did not recognize the data augmentation parameters when they are clearly a part of the notebook. I did not want to attach screenshots of my code, but I am attaching all other grader outputs as screenshots as well as the relevant instruction cell from the lab.

Any help is greatly appreciated.




Your error log mentions issue with train Val generator code error related to

  1. Rotation range
  2. Height shift range
  3. Width shift range

For the image data generator section.

Kindly do the correction. You can refer week 2 videos again as the instructor explains these parameters clearly. The value for these three should not be absolute zero.

Regards
DP

They are not zero. You can verify it yourself with the screenshot of the notebook.
(I apologize I don’t know how to send a private message, please feel free to delete this once you have seen the code).

Also, if you could explain the accuracy part that would be really helpful.
[REMOVED]

Hello Tushar,

Why is there too much variation in your batch size between training set and validation set, what will that result in? That is causing the train_val_generator failure

I also would request you to click on pen symbol of edit option and delete that image which contains codes. It is against community guidelines to share any part of grader cell codes.

You can always send the notebook, if a mentor ask for it. Always click on mentors name and then message to send your any part of the code or notebook if or any required to assess your codes or notebook.

Also notice the grader output mentions the accuracy of the training set should behiher or 5% difference than validation set, so what changes could you make to achieve the desired results?

What are the factors affecting a model training?

Regards
DP

I notice that the grader output says that the accuracy should be higher on the training set than the validation set. The instructions in the notebook say that:

  • both training and validation accuracy should be 80%
  • final testing accuracy should be higher than training

Both these conditions are true for my model’s output. Which was my initial question- why does there appear to be a discrepancy in what the instructions say and what the grader expects? Plus, if you notice, the difference between the accuracy metrics is never 16% in any epoch as the grader says, but closer to 3-6% on average.

I have removed the code snippet. As for the difference in batch sizes, I thought that since the training set was 10x larger than the validation set, I adjusted the batch size in the generators accordingly. It did not seem to affect the model’s performance when I retrained the model and set both batch sizes equal to 32, however this seemed to solve the problem with the grader output in the function.

Thank you for your help. I was able to solve one issue and pass the assignment. On the second submission, the grader passed my model as well.

Hope you have a great day!