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
#overfiting problem in CNN model
76 messages · Page 1 of 1 (latest)
what is your dataset size
how much is overfitting your dataset? Please drop some metrics to understand the problem 😉
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)
]
that the learning progress
the model i was usig
vealuation score and loss graph
accurcy
my dataset images are like this i created the dataset by myself and with 2 more other friends the image size is 300x300
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
Yeah but the real problem is when I test it on live cam then it doesn't even predict any alphabet it just same alphabet for many symbols on live data it's accuracy is like bearly 1% or 2%
Any solution? I have been trying to solve this problem for many days
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
if u want yes drop the dataset that u're using, or just explain the differences between train-testing and real cam data
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
here is the dataset link : https://drive.google.com/file/d/1jHA9ZDQ0XAfhOP-9-zU3mMsffGcFE0vS/view?usp=sharing
Google Docs
i have tried on 8,16,32 and 64 batch size and and first i was using early stoping callback with 50 or more epoche but it took so much time with no result so i start trying on 10 or 5 epochs
first i tried without droupout then 0.5 dropout even 0.7 but problem was still same
I see
img format is .jpg
I think, the CNN layer structure would be considered
Img format is not matter 😄
Can I take a look into your project?
yeah sure
@earnest reef
Could you make a github repo for your project?
actually i had many notebooks where i trained model for this project but now i only have one cuz i deleted some of the project files by mistake
I see, one note that contains recent CNN structure would be okay
now i only have the last notebook where i was using a custom small model on larg dataset
it is being uploaded here
can you send me one example of picture?
Okay
it will take time so
this
its above in chat
here is the jupyter-lab notebook file
I confirmed
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 here is my linkedin
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
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
It doesn't seems good
If your validation is fine but your testing is not, its not a model issue, its an implementation issue
check your code again
I used the same function to collect the data
As u can see in this in first epoch I got 44 train accuracy and 95 val accuracy? It doesn't seems good @cerulean eagle
What do you mean by evaluation method
I m using model.eveauation
But in the above img that train and val accuracy is during training
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)