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?
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.
See my later post. This solution may or may not work depend on what you do. But it definitely inefficient.
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))]
[get_sample_image().apply_tfms(tfms, size=224, padding_mode='zeros').show(ax=ax)
for i, ax in enumerate(plt.subplots(rows, cols, figsize = (width, height)).flatten())
The tutorial seemed to use np.linspace to loop thru each value, and test each transform to highlight what they do.
This is again not good, since you will have to call that transform 4 times.
i want to perform dihderal one/one all and perform an average ,dont want randomness in it .
How can i do it…