A bit confused about the usage of transforms

Hi everyone !

I’m working on image segmentation from satellite images (binary classification, the goal is simply to detached roads). I’ve mainly used the example from camvid to train my model and everything works as intended, it trains wells and gives acceptable results.

Now I want to make my results better. The first thing to do is data augmentation because I only have 100 images in total, 10 of which I keep for validation so only 90 for training.
I’ve spent a lot of time on the doc of the transforms and just finished watching lesson 11 (which ends with the explanation of the main transforms) but I’m still confused about what really happens when doing transforms in fast ai.

From the source of my data, I create the Databunch doing :

data_augm = (src.transform(get_transforms(do_flip=True,
p_affine=1), tfm_y=True)

But when I type data on a new cell after doing this, I get the following result :


Train: LabelList (90 items)
x: SegItemListCustom
Image (3, 400, 400),Image (3, 400, 400),Image (3, 400, 400),Image (3, 400, 400),Image (3, 400, 400)

I would expect my training data bunch to be of size more than 90. So what happened there ?

Have the transformations occurred but are not shown in the ImageDataBunch stat ?

Any enlightenment on what happens behind the scene would be greatly appreciated !

Thanks a lot :slight_smile:

EDIT : Subsidiary question, I have succeeded in reproducing the example of the 7 dihedral transformations from here but I can seem to right the appropriate function to do se in get_transforms (because dihedral takes an image (x) and an int (k) as an argument and I don’t know what should be x in our case. Any clue ?

This should help answer your primary question: How does get_transforms work?

1 Like

Thanks a lot ! That’s exactly what I needed. So the original dataset is not changed (neither duplicated as I thought) but every batch will show a modified version of the original version, using the transforms parameters that we setup.

1 Like