libffcv / ffcv

FFCV: Fast Forward Computer Vision (and other ML workloads!)
https://ffcv.io
Apache License 2.0
2.79k stars 180 forks source link

Mapping from torchvision transforms to FFCV transforms #337

Open meghbhalerao opened 11 months ago

meghbhalerao commented 11 months ago

Dear Authors,

Is there is 1 to 1 mapping from the image transforms that are supported by torchvision and those of ffcv, more specifically, when I see this page - https://docs.ffcv.io/api/decoders.html#ffcv.fields.decoders.CenterCropRGBImageDecoder - I see that a lot of these are very similar to the ones that torchvison has, since we want an equivalent dataloader in both ffcv and pytorch, here is a list of torchvison transforms - https://pytorch.org/vision/0.8/transforms.html - just adding this here for reference.

The above context brings me to specific question that I had - I want to do a simple resize of images, how do I do that in ffcv, I see here that https://docs.ffcv.io/api/decoders.html#ffcv.fields.decoders.CenterCropRGBImageDecoder - there is a center crop but that does cropping first and then resizing, can I just have an op which does a simple resize?

In a broader context, if someone can provide some common torchvison transforms followed by their equivalent ffcv counterparts, that would be super useful!

Thanks for your time!

wouterzwerink commented 11 months ago

You can probably use ffcv.fields.decoders.RandomResizedCropRGBImageDecoderand set scale=(1.0, 1.0) and ratio=(1.0, 1.0). I agree there should be a ResizeDecoder though