Oversampling in CIFAR-10
josianerodrigues opened this issue · 2 comments
josianerodrigues commented
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?
chengyangfu commented
Hi @josianerodrigues ,
There are two ways to solve your problem.
- Change the sampler in dataloader. Use the WightedRandomSampler.
- Or add the weight in the loss function.
josianerodrigues commented
Thank you for the suggestions. I'll test them :)