Where Do Transforms Happen In the Library?

I feel kind of silly asking this, but I was debugging the data block API of v1.0.54 and I couldn’t seem to pin down where in the codebase images get transformed. Here’s what I think I know:

  • In DeviceDataLoader there is a proc_batch() method which does the following: for f in listify(self.tfms): b = f(b).

  • This method gets called when iterating through the data loader with next(iter(data.train_dl)) syntax.

  • Yet, the self.tfms in the line of code above does not depend on what I pass into the .transform() method of the LabelLists. That is whether I pass in the default transforms that come from get_transforms() or remove the .transform() method from the chain in the data block, the self.tfms is the same (which is either None or a transform for normalization if I normalize at the end).

I’m clearly missing something. Any help?

Look into data_block.py -> LabelList class -> __getitem__ method

Image transformations are done on the dataset object and the normalization is done on the data loader object.

1 Like

Much appreciated, Renato. I’ll take a closer look at that.