Hope you are doing good.
My training accuracy is not getting near to 95% -
I am using 3 Layer and I used the Adam as optimizer - but still its not increasing.
model.compile(optimizer=tf.optimizers.Adam(learning_rate=0.001), loss=‘binary_crossentropy’, metrics=[‘accuracy’])
Graded Functions
Filename: Graded Functions
50/50Score: 50 of 50
Show grader output
Training History
Filename: Training History
25/50Score: 25 of 50
Hide grader output
Grader output
Failed test case: training accuracy under 95%. Expected: 0.95 or above, but got: 0.8589652180671692.
The issue here was that image augmentation was being used, which resulted in the training accuracy not reaching the necessary threshold within 15 epochs. For Week 1 be sure to not use data augmentation since this will be the focus of Week 2.
Hi can you please tell where is image augmentation being used in the code and do we need to explicitly remove it? As of now I am using 4 conv layers but still not able to go beyond 91% training accuracy.
Hi @Sonam_Sharma, within the train_val_generators function when instantiating the ImageDataGenerator you should only set the rescale argument to not use data augmentation. Setting additional parameters will most likely result in image augmentation being used.
Regarding C2W1AND C2W2 training accuracy, I too am unable to get either training accuracy above the required. I got to 76% on the last try.
I have added two convolutional layers, changed the learning rate, the batch sizes and even changed one of the augmentation parameters in the Week Two network.
Please give me something to try.
As an aside, I now see how a professional can become frustrated waiting for the network to train! I’ve even had to buy GPU time to keep trying to get this thing to behave.
Thanks, that seems to be the key.
It’s not obvious, as the lesson’s notebooks always use batch sizes of 20. (I will get back to the lesson where this parameter was introduced to understand why it has impact on training accuracy).
Similarly, number of validation images
must equal validation batch size * steps_per_epoch
So, since steps_per_epoch will be the same (I suppose it is computed by model.fit, since we don’t pass it), batch size must be proportional with the number of images in the corresponding image set.
It means that the lesson’s notebook is doing something weird (not to say “wrong”), since it defines batches of 20 for both sets, whereas training set has 9 times the number of images of the validation set. Which means it will be 9 times more batches of training data. Which means, in turn, I presume, that model.fit will only call the first (1/9th) batches of training data, ignoring the other 8/9th.