Args: crop_shape: (h, w), int or a tuple of int
(self, crop_shape)
| 18 | """ Randomly crop the image into a smaller one """ |
| 19 | |
| 20 | def __init__(self, crop_shape): |
| 21 | """ |
| 22 | Args: |
| 23 | crop_shape: (h, w), int or a tuple of int |
| 24 | """ |
| 25 | crop_shape = shape2d(crop_shape) |
| 26 | crop_shape = (int(crop_shape[0]), int(crop_shape[1])) |
| 27 | super(RandomCrop, self).__init__() |
| 28 | self._init(locals()) |
| 29 | |
| 30 | def get_transform(self, img): |
| 31 | orig_shape = img.shape |