List of transformations doesn't work

I don’t understand the right way to use Fast ai transformations.
I’m trying to pass a list of transformations, but it only works for some specific transformations, like in the above exemple:


Whereas for others, like the above, it gives an error:

Or for this one as well:


Is there a right way to pass any transformation to the list? I’ve read the whole documentation on this part and it wasn’t helpful.

Thanks in advance

zoom_crop returns a list, so you don’t need to add brackets.

2 Likes

Thanks @sgugger,

What if i want to use tilt and zoom_crop as trasnformations? Since one must be passed inside a list and not the other, how could I fix it? Also, any ideas why tilt return ‘int’ object ahs no attribute pixel?

I printed out get_transforms() to see how they were passed, and they’re all passed in a list of RandomTransform. Is it what I should do? Is there any source exaplining how to use it?

Thanks again!

About the tilt transformation,

Well to have tilt and zoom_crop, you jsut do [tilt(…)] + zoom_crop(…)
All those are RandTransform, you don’t need to do anything on your side.

1 Like

Thanks!
The problem with tilt is that it isn’t working not even alone (inside a list or not), see below:

I don’t think it is a problem with the parameters i’m passing, since if I do img.tilt(1, -0.4) it works,

Thanks again

You should use the kwargs because it’s possible the function is tried to apply titl to 1. This works for me:

tilt(direction=(1,1), magnitude=-0.4

Note that you have to specify a tuple for uniform, but if you want one value (second one included).