Fastai v2 vision

This maybe a noob question. I want to use the mnist image as the x AND the y in an experiment. However, I only want to apply augmentation to the input, x. I can’t figure out how to prevent the augmentation on the target, y.

mnist = DataBlock(blocks = (ImageBlock(cls=PILImageBW),ImageBlock(cls=PILImageBW)),
                  get_items = get_image_files,
                  splitter = GrandparentSplitter(train_name='training', valid_name='testing'),
                  batch_tfms = [RandomErasing(p=1)],
                  n_inp = 1)

This results in RandomErasing applied to x and y:


Is this not possible in the High level API?

1 Like