0
$\begingroup$

So I wrote a convolutional neural network for a binary image classification. I have around 5300 images for each class which I thought would be enough to at least give me a good accuracy on the training cases. When the training was finished, I wrote a program to find the accuracy for each class (here's what I mean: consider class A. I ran a for loop through all the training images that belonged to class A, gave the images to my classifier and divided the number of images that my classifier classified as a class A image by 5300).For class A, the accuracy was pretty good (around 96%). But for class B, the accuracy was only 80%. Further more, I did the same thing with the testing images and found out that the accuracy for class A was 95% but for class B was 70%.

What can I do in order to improve my accuracy? I thought about augmentation but wasn't sure whether to do it for both classes or just class B.

Thanks in advance!

P.S: I think the main problem that causes this is that the two classes are really alike but I don't really know how to deal with it so any help regarding that would be appreciated!

$\endgroup$
  • $\begingroup$ Why didn't you just use a test set to evaluate your model in the conventional way? What you do is quite strange. First you train your model, then you run the training loop again on only class A, and then only on class B? If you haven't put your model in some evaluate stance (no weight updating), then of course your model will be biased towards class A after that extra training on class A. It is no surprise then that class B performs so badly. $\endgroup$ – Bram Vanroy Sep 26 at 11:49
  • $\begingroup$ @BramVanroy I think I didn’t explain what I did very well. After I trained my model once, I didn’t train it again on class A. What I did do was, instead of choosing some images from class A and some from B and testing the model on those, I just chose images from class A and tested my classifier on those. It got 96% of them right. Then, I chose some images from B and tested my classifier on just those. It got 80% of them right. $\endgroup$ – Borna Ahmadzade Sep 26 at 11:59
  • $\begingroup$ You can either use dropout in some layers.You can also different number of training and testing sets. $\endgroup$ – mithilesh pradhan Sep 30 at 12:06

Your Answer

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

Browse other questions tagged or ask your own question.