# How to perform pure 4-rotation with get_transforms

I was reading the doc on get_transforms. It seemed setting flip_vert=True will result in 8-rotations. How do I configure this if I only want 4-rotation without any flipping. E.g. let say if i want to identify text strings, flipping them left-right will result in unreadable text.

Can this be dis-entangled? flipping vs. rotation?

Update:

tfm = [rotate(degrees=0, p=0.25), rotate(degrees=90, p=0.25), rotate(degrees=180, p=0.25), rotate(degrees=270, p=0.25)]

img = get_ex().apply_tfms(tfm)

get_ex() is a method defined in the documentation of data aug to open a new image.

Although a bit verbose, i think that works.

UPDATE

See my later post. This solution may or may not work depend on what you do. But it definitely inefficient.

1 Like

The solution I found is not good enough. It may not be â€śstatisticallyâ€ť correct cos it is tossing the dice 4 times and apply the results (probably in sequence). I donâ€™t bother to prove this mathematically, performing 4 transforms is a waste computationally.

I want a 4 sided dice toss once and apply once.

I havenâ€™t tried it yet but perhaps something like this is what youâ€™re looking for:
`rotate( degrees=np.linspace(0,270,90) )`.

The docs seem to have some examples with `rotate` on this page that might help you: https://docs.fast.ai/vision.transform.html#Randomness

This does not work:

``````tfms = [rotate(degrees=np.linspace(0,270,90))]