MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / TranslateY

Function TranslateY

datasets/augmentation/randaugment.py:94–99  ·  view source on GitHub ↗
(img, v)

Source from the content-addressed store, hash-verified

92
93
94def TranslateY(img, v): # [-150, 150] => percentage: [-0.45, 0.45]
95 #assert -0.3 <= v <= 0.3
96 #if random.random() > 0.5:
97 # v = -v
98 v = v * img.size[1]
99 return img.transform(img.size, PIL.Image.AFFINE, (1, 0, 0, 0, 1, v))
100
101
102def TranslateYabs(img, v): # [-150, 150] => percentage: [-0.45, 0.45]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected