No, the transforms are applied at the dataset level, not the dataloader level (you have transforms for both).
@sgugger Sorry, it is still not clear how the transforms are being applied on just the dataset. As I showed in my previous post, starting from the Learner.fit function it seems that the dataloader-level transforms are being applied during training.
And if there are transforms for the dataloader level, how do I indicate which ones to use for that?
Ok I think I understand now. So when you create a
DataBunch with the DataBlock API, we create a
LabelList, which subclasses
Dataset and in the
__getitem__ method it applies the transform to the single data point. When the
DataBunch is created, the DeviceDataLoaders are created from these
LabelLists. If there are any
dl_tfms they can be applied. It seems like they can be passed into the
.databunch() function of the DataBlock API.
So my main question would be what is the correct API for the Transforms? I assume we can pass in any of the transform classes (
TfmPixel). Or will only affine transforms work because they are just matrix multiplication and can easily be done on the GPU?
You can’t pass any of the fastai data augmentation transform as a dataloader transform no, since they expect images. I said earlier in the thread that the transforms could be adapted to do some data augmentation on the GPU, which is exactly what we have done for v2. But you can’t pass the ones from v1 without rewriting their code.
So what would the dataloader transforms expect? The code seems to indicate they would just be functions that take in tensors and output new tensors. Is this true?
Yes, it’s a function that takes a batch and returns the transformed batched.
Thanks! In the course part 2 notebook over here under batch augmentation, it mentions something about generating a grid and interpolating, which I was slightly confused about. Do I have to do this as well?
Yes. That or waiting for v2.