I am dealing with a binary image classifier. I'm using a CNN to predict if an image is positive or negative. The problem is that the positive class represents only the 2% of the total samples. In this case, I can get lots of images, so that is not a problem. My question is about what is the best option to set up the dataset. One option is to have an unbalanced dataset, if it is extremely unbalanced like this case, the net won't learn, it'would only predict the major class. The other option is to artificially balance the data. What I've done is preparing a dataset with a 40% of the positive class and a 60% of the negative class. This dataset does not represent the real problem and is making lose a lot of samples. Is there a better option?



Instead of downsampling the dataset, you should try using the Upsampling technique. Sometime downsampling leads to loss of data. Use augmentation techniques to increase the size of your dataset.

  • $\begingroup$ That's what I'd usually do but this is a special case. The images are taken from an industrial camera, this means that the images wold not rotate, change brigthness etc. In this scenario does it makes sense to use data augmentation? $\endgroup$
    – hardsoft
    Sep 4 '20 at 19:39
  • $\begingroup$ You should at least try this scenario and see the results. And If this won't work then you have to opt for another approach. $\endgroup$
    – Rina
    Sep 8 '20 at 4:05
  • $\begingroup$ Why change the class ratio? $\endgroup$
    – Dave
    Oct 9 at 1:55

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.