C2W2 - Assignment not reaching 80% accuracy

Hi,

course : DeepLearning.AI TensorFlow Developer Professional Certificate

Course 2 - CNN with image augmentation

In C2W2 , Cats vs Dogs classification using Data Augmentation , should get 80% as accuracy with 15 epochs but I am getting only 78.

I have applied 90 as batch for training and 10 as batch for validation

Applied same parameter values what is shown during training videos for image augemtation.

Any help will be appreciated

Epoch 15/15

250/250 [==============================] - 165s 661ms/step - loss: 0.4544 - accuracy: 0.7835 - val_loss: 0.4166 - val_accuracy: 0.8040

Please start with a batch size of 32 & explore from there. Did you rescale the images as part of using ImageDataGenerator ?

Thanks Balaji. Finally I fixed it.

  1. Reduced number of filter layers - instead of 32,64,128… set it to Do not post direct solutions to your query, instead a hint should be mentioned
  2. Changed the optimizer to Adam
  3. Batch size set to do not provide direct solution to your queryfor training and validation
  4. Yes rescaled both training and validation images

Epoch 15/15
250/250 [==============================] - 166s 664ms/step - loss: 0.3843 - accuracy: 0.8279 - val_loss: 0.3312 - val_accuracy: 0.8460

4 Likes

Hello i have same architecture with you, how much ETA you got? do you use colab pro or not?
Thank you

when I switched to adam from RMSprop and with 5 Conv2D layers, it worked on 25the epoch for me.

1 Like

I think it is common to use the labs for a given (weekly) lesson to solve the assignments. Especially the new thing that is being taught.

When I got to the assignment I started by crafting a solution that used the previous prototypes. I ran into some troubles:

  1. The Input directive in defined in the obvious solution for defining the create_augmentation_model() is not seen by the unit test(s) when stacking the layers when defining create_model() function. AND if you abstracted out the non-augmentation layers into their own function and then also stacked that layer in the create_model() function, following the prototype introduced in lab 1, it would also generate an error for not seeing the Rescaling layer. In short the unit test(s) doesn’t seem to know how to look more deeply into the generated model object to see these methods are being defined. That is a failure of the course materials. A simple solution is to stack it all explicitly in the model = tf.keras.models.Sequential([]) statement, but this violates the implied lesson of modularity demonstrated in the labs.

  2. I too initially had problems not reaching the 80%/80% required. I fumbled around with this and wasted some time but I also learned new relationships about the layers and, I hope, re-enforced the lesson. AS A HINT I can tell you the lesson is about augmentation and so when you don’t get 80%/80% it makes sense to go back to that key point, versus the non-augmentation layers, to find out how to solve the problem. That said, examining the details of the optimizer can also be very helpful.

  3. The training and validation accuracy graph is really erratic as it pertains to the Validation accuracy and loss. I would really like someone to answer here or add to the lesson why that is, since it is different than what we’ve seen before.

Thanks.

–J