I noticed omniglot has this. What is it doing and why do we need it?
I'm reading:
class RandomClassRotation(object):
"""
[[Source]]()
**Description**
Samples rotations from a given list uniformly at random, and applies it to
all images from a given class.
**Arguments**
* **degrees** (list) - The rotations to be sampled.
**Example**
~~~python
transform = RandomClassRotation([0, 90, 180, 270])
~~~
"""
def __init__(self, dataset, degrees):
self.degrees = degrees
self.dataset = dataset
def __call__(self, task_description):
rotations = {}
for data_description in task_description:
c = self.dataset.indices_to_labels[data_description.index]
if c not in rotations:
rot = random.choice(self.degrees)
if float(tv.__version__.split('.')[1]) >= 11:
rotations[c] = transforms.RandomRotation((rot, rot))
else:
rotations[c] = transforms.Compose(
[
transforms.ToPILImage(),
transforms.RandomRotation((rot, rot)),
transforms.ToTensor(),
]
)
rotation = rotations[c]
data_description.transforms.append(lambda x: (rotation(x[0]), x[1]))
return task_description
but it's not clear what it does, since it seems the rotation affects the classes? Does it affect the classes or the images?
A high level description is enough.
(a better example that prints the image and class inde if it changes both would be nice too)
I noticed omniglot has this. What is it doing and why do we need it?
I'm reading:
but it's not clear what it does, since it seems the rotation affects the classes? Does it affect the classes or the images?
A high level description is enough.
(a better example that prints the image and class inde if it changes both would be nice too)