rwightman/gen-efficientnet-pytorch

Apply correct transforms to data

cipri-tom opened this issue · 2 comments

Hi Ross,

Thanks for making this easily accessible repository !

I apologize in advance I'm opening an issue to ask about usage, but it'll pass a bit more until geffnet will have its own tag on stackoverflow 😊

I am interested in using pretrained models with a new dataset. The problem is that this new dataset is not yet in a good shape: images have different sizes, so when I try to load an ImageDataBunch I get warnings about this. I could apply size parameter, but I wanted to ensure that all the transformations are consistent with the model.

Is there a way to get the transforms needed for a model? I have seen the data folder, together with create_loader, but it is not clear how to use this with ImageDataBunch.

Any advice would be much appreciated !

@cipri-tom The transforms here are just examples for validation. I've got transforms in a different repo tailored for ImageNet (https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/transforms_factory.py) ... but since you're using fastai best to ask there as it's more related to the training framework youre' using than the model, all pretrained models are pretty much the same, they work best (but will work fine in many other cases) if you feed them images at the native size, interpolation, and normalization as their pretrained weights (see README for these modesl)

I understand. Thank you ! Also for pointing out the other repo 👍 . It seems way more flexible.