CNN seems to be too inaccurate to classify my images. Is there an alternative that I can explore?
8 views (last 30 days)
Show older comments
Teshan Rezel
on 21 Feb 2020
Commented: Daniel Vieira
on 26 Feb 2020
Hi folks,
I've attached examples of 2 different classifications for images that I'm working with below. My CNN (and a retrained Alexnet) seem to be too inaccurate to classify the images reliably.
Is there an alternative image classification technique that you'd recommend I use?
Thanks in advance
Classification 1
Classification 2
0 Comments
Accepted Answer
Daniel Vieira
on 21 Feb 2020
Alexnet is the simplest of the pretrained deep learning models, you might want to try others (resnet, inception, etc).
You might also not have enough images to get a good model, I don't know how many you have.
You might be experiencing overfitting, how went the training? A near 100% accuracy in training data with not that much in validation data would be a pretty strong indication of overfitting. You can avoid overfitting with image augmentation, dropout layers, etc.
Also, some problems have inherently ambiguous classes. A network to classify musical genders in song files might have a hard time in separating similar musical subgenders, for example. You might take some time to think if this is not your case. If it is, your network might not be "innacurate" at all, you problem is inherently difficult instead. The prediction class scores might give an idea of such ambiguities: 2 classes appearing with average-ish scores, indicating the image might belong to either.
2 Comments
Daniel Vieira
on 26 Feb 2020
99.6% seems rather accurate to me, does your application really need more...? Or is this only on the training data, and it's performing poorly on test data?
also, I noticed that, by your MaxEpochs, MiniBachSize and ValidationFrequency parameters, you only let your network make 2 validations, it is probably finishing training by number of Epochs instead of validation criteria, which is a bit pointless. I would let it make validations more often, like every 5 or 10 iterations, and increase MaxEpochs. Then also set a ValidationPatience value to 5 or 10 (default is infinite, which doesn't help at all).
Another thing that might help is setting learn rate decay parameters (LearnRateSchedule, LearnRateDropFactor and LearnRateDropPeriod). Setting these parameters makes learning slow down as it goes on, effectively "refining" your model as it nears the end of training.
you could also try other training optimizers, sgdm is only 1 of them. I feel adam tends to do a better job (but I admit this is just a feeling). Adam optimizer already has a built-in learn rate "modulation" feature, so it doesn't use the LearnRateSchedule, LearnRateDropFactor and LearnRateDropPeriod parameters.
More Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!