MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / get_transform

Method get_transform

tensorpack/dataflow/imgaug/geometry.py:31–40  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

29 self._init(locals())
30
31 def get_transform(self, img):
32 max_dx = self.horiz_frac * img.shape[1]
33 max_dy = self.vert_frac * img.shape[0]
34 dx = np.round(self._rand_range(-max_dx, max_dx))
35 dy = np.round(self._rand_range(-max_dy, max_dy))
36
37 mat = np.array([[1, 0, dx], [0, 1, dy]], dtype='float32')
38 return WarpAffineTransform(
39 mat, img.shape[1::-1],
40 borderMode=self.border, borderValue=self.border_value)
41
42
43class Rotation(ImageAugmentor):

Callers

nothing calls this directly

Calls 2

WarpAffineTransformClass · 0.85
_rand_rangeMethod · 0.80

Tested by

no test coverage detected