0
$\begingroup$

Update: Please see below for my own answer

I'm training from scratch a simple CNN multi-class classification (images taken from a small camera are black and white). I tried it with 2x conv layers and now i've worked up to 4x; likewise i've tried from 700,000 params to now about 10,000 but it's all the same with the 1st epoch performing well and the rest not so. I've just tried randomly restarting a bunch of times and got max 70% val_accuracy

enter image description here

I've referred to this : https://stackoverflow.com/questions/59201907/overfitting-on-image-classification, https://stackoverflow.com/questions/68154422/why-is-tensorflow-image-classification-model-overfitting, https://stackoverflow.com/questions/59078738/how-to-improve-model-to-prevent-overfitting-for-very-simple-image-classification,

I have 4 classes with 1000 image per class

This is my model architecture: Model architecture

I'm using reduceLRonPlateau and checkpoint; took out early stopping because it was stopping early basically it overfits with the lowest val_loss at 1st epoch. Do i need more data? I've already tried the imagedataaugmentation. This is the snapshot of the training

enter image description here

this is what i've added in my convlution layer code that produces the above results :

kernel_regularizer='l1', 
bias_regularizer=regularizers.L2(1e-4)```

i have no fully dense layer just the output layer straight after flatenning
$\endgroup$

1 Answer 1

1
$\begingroup$

This was an issue I was struggling with for over a week but the eventual problem seemed to be perhaps something in the way the function was done; Initially I used flow_from_directory and after exhausting all other methods linked to overfitting - augmentation, dropout, regularization, parameters, number neurons, layers, callbacks, checking my own captured original data - I tried using image_dataset_from_directory and it solved it; nevertheless I will repost the initial problem here in case anyone in future faces the same issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.