#overfiting problem in CNN model

76 messages · Page 1 of 1 (latest)

earnest reef
#

Hello everyone I have been trying to train a model for ASL ( Amrican sign language) transaction from hand signs to text I'm just using alphabets and two more classes for space and delete so I have total 28 classes and it just a image classification problem so I try to train a cnn model but I didn't get the good accuracy on new data my model is overfitting I have tried everything like data augmentation reducing the complexity of model adding dropout, even transfer learning on different modes of cnn like vgg16 ,regnet, efficentNet, etc. but every time results are same model is overfit
I need someone to guide me

cerulean eagle
#

what is your dataset size

limber hollow
#

how much is overfitting your dataset? Please drop some metrics to understand the problem 😉

earnest reef
# cerulean eagle what is your dataset size

i was first trying with smaller dataset with 1500 images in each classes after splitting they are 1200 in each classes but now i have augmented the dataset and now i have almost 22600 imgs in each class i oprated all these augmentation oprations but the problem is still same

def augment_image(image):
    augmentations = [
        A.HorizontalFlip(p=1),
        A.VerticalFlip(p=1),
        A.Rotate(limit=45, p=1),
        A.ShiftScaleRotate(shift_limit=0.1, scale_limit=0.1, rotate_limit=45, p=1),
        A.RandomBrightnessContrast(p=1),
        A.HueSaturationValue(p=1),
        A.RGBShift(p=1),
        A.CLAHE(p=1),
        A.GaussNoise(p=1),
        A.ISONoise(p=1),
        A.GaussianBlur(p=1),
        A.MotionBlur(p=1),
        A.MedianBlur(blur_limit=7, p=1)
    ]
earnest reef
#

the model i was usig

#

vealuation score and loss graph

#

accurcy

earnest reef
#

my dataset images are like this i created the dataset by myself and with 2 more other friends the image size is 300x300

limber hollow
#

hoping this overfitting for all model that i'll develop to be honest ahahah, ur model is working so well the overfit is minimal to say this

earnest reef
earnest reef
#

But I m Just stuck here

#

I can upload dataset online and give u the link of dataset so u can try by ur self if u like

limber hollow
#

if u want yes drop the dataset that u're using, or just explain the differences between train-testing and real cam data

native citrus
#

I know this is a simple answer but , epoche, batch and dropout rate, please

#

And also, based on image format, need to design the CNN layers would be considered

#

If you share your project, then I will provide a solutions

earnest reef
earnest reef
native citrus
#

I see

native citrus
#

I think, the CNN layer structure would be considered

#

Img format is not matter 😄

#

Can I take a look into your project?

native citrus
earnest reef
#

how should i share notebook ??

native citrus
#

Could you make a github repo for your project?

earnest reef
native citrus
#

I see, one note that contains recent CNN structure would be okay

earnest reef
#

now i only have the last notebook where i was using a custom small model on larg dataset

native citrus
#

Okay

#

While I am downloading zip folder.

earnest reef
native citrus
#

can you send me one example of picture?

native citrus
earnest reef
earnest reef
native citrus
#

I confirmed

earnest reef
#

in the last cell of this notebook u can uncomment the code and test the model on live data u just need to change the path

#

of the model

native citrus
#

OKay

#

How can I call you? Can I have your linkedin profile?

earnest reef
native citrus
#

Thanks for sharing

#

Hi

#

I have checked the CNN Structure

#

Here is my suggestion

#
  • After last MaxPool, add one Conv2D and MaxPool as same before
#
  • Add one dropout Layer with 0.5 dropout rate
#

This is the missing part

earnest reef
#

but are you sure this will work ?? cuz i have tried vgg16 transfer learning and some other model like regnet too but results are same

#

let me try

earnest reef
cerulean eagle
#

If your validation is fine but your testing is not, its not a model issue, its an implementation issue

#

check your code again

earnest reef
earnest reef
cerulean eagle
#

Well, its good, but probably not right

#

You should check your evaluation method

earnest reef
#

I m using model.eveauation

#

But in the above img that train and val accuracy is during training

clear oasis
#

from a quick read of this thread two things come up to mind 1) like they said this isnt over fitting per-say 2) the reason real life testing is giving the same class for different signs is due to two things first the preprocessing must be exactly the same as the preprocessing made before training the model and secondly you might be passing the whole iimage that includes you and the hands with the sign which confuses any cnn model so you should implement soome type of way to auto crop the hands only so that it can be passed to the cnn and not the whole image

#

something irrelevant to your question tho, why use image classification when as i see from the image you have anchor points for the hands and fingers ? you should use other models aside from this for better accuracy and faster inference (real-time prediction)

#

(i dont know the exact models to be honest but im sure cnn isnt the best approach to this as far as i know)

cerulean eagle
#

Oh, I just realized that it might actually be fine.

#

Since the accuracy of your model on training epoch is the average of all results, which include results from both a model that is completely randomized (0 epochs) and a model that has been trained reasonably (1 epoch)