I have an unbalanced dataset and I’d like to have more transformations for two of the classes. I haven’t seen any tutorial about it.
This code snippet might be what you are looking for.
I see! So if I understand correctly, there’s no way to write class-dependant transformations without a custom dataset class.
I think a custom
Dataset might be the easiest way.
Alternatively, you could write a custom transformation using e.g. RandomApply as the base code and add the condition on the target.
However, this would also need the target as an input, which would most likely not work as a drop-in replacement for the vanilla transformations in torchvision models.