How could I improve the output (accuracy and validation_accuracy)

I tried several patterns of the learning model, but I still didn’t achieve “a training and validation accuracy of at least 80% and the final testing accuracy should be either higher than the training one or have a 5% difference at maximum”.

How could I improve the result? Increasing epoch? Considering adding many layers? Should I make image generators more complex?

I want some idea.

one of the failure examples:

image

Hello @Kenji_Otsuka ,

Welcome to the community!

1. Under:
GRADED FUNCTION: train_val_generators
There is a part in between:

 # Pass in the appropriate arguments to the flow_from_directory method to
# train_generator and validation_generator

Instantiate the ImageDataGenerator class (don’t forget to set the rescale argument)
This hint is missing though from your screenshot, which might got erased somehow.You may again click on the link to see it-Notebook

Although I can see your code for this part, where You have taken so many arguments which were not needed.Only the first line is needed as mentioned in the hint, which is just to rescale only.

So it will be :
validation_datagen = ImageDataGenerator(rescale=1.0/255.)

2. For model = tf.keras.models.Sequential() ,
use lesser filters for Conv2D.

3. For model.compile(),
you dont need RMSprop, use Adam optimizer
and for loss use SparseCategoricalCrossentropy()

Hope this helps.

With regards,
Nilosree Sengupta

Thank you, @nilosreesengupta

I will try again.

Thank you. I passed the assignment with 95/100 score.

Hello @Kenji_Otsuka ,

That’s Great!
You are welcome!!

With regards,
Nilosree Sengupta