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

Function TranslateX

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

Source from the content-addressed store, hash-verified

77
78
79def TranslateX(img, v): # [-150, 150] => percentage: [-0.45, 0.45]
80 #assert -0.3 <= v <= 0.3
81 #if random.random() > 0.5:
82 # v = -v
83 v = v * img.size[0]
84 return img.transform(img.size, PIL.Image.AFFINE, (1, 0, v, 0, 1, 0))
85
86
87def TranslateXabs(img, v): # [-150, 150] => percentage: [-0.45, 0.45]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected