chengyangfu/pytorch-vgg-cifar10

Oversampling in CIFAR-10

josianerodrigues opened this issue · 2 comments

Hi,

I need to train this model (VGG) using some oversampling technique in the Cifar-10 database. But I do not know how to do it in Pytorch.
I want to simulate a dataset of real world, since in the real world the classes are unbalanced. However, I need to adjust the network to learn the unbalanced classes. So first I need to simulate the problem of class imbalance at the dataset, because CIFAR-10 is a balanced dataset. And then apply some oversampling technique. Could you give me an example?

Hi @josianerodrigues ,
There are two ways to solve your problem.

  1. Change the sampler in dataloader. Use the WightedRandomSampler.
  2. Or add the weight in the loss function.

Thank you for the suggestions. I'll test them :)