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

Class FlipTransform

tensorpack/dataflow/imgaug/transform.py:171–194  ·  view source on GitHub ↗

Flip the image.

Source from the content-addressed store, hash-verified

169
170
171class FlipTransform(Transform):
172 """
173 Flip the image.
174 """
175 def __init__(self, h, w, horiz=True):
176 """
177 Args:
178 h, w (int):
179 horiz (bool): whether to flip horizontally or vertically.
180 """
181 self._init(locals())
182
183 def apply_image(self, img):
184 if self.horiz:
185 return img[:, ::-1]
186 else:
187 return img[::-1]
188
189 def apply_coords(self, coords):
190 if self.horiz:
191 coords[:, 0] = self.w - coords[:, 0]
192 else:
193 coords[:, 1] = self.h - coords[:, 1]
194 return coords
195
196
197class TransposeTransform(Transform):

Callers 1

get_transformMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…