Args: prob (float): probability of flip. horizontal (boolean): whether to apply horizontal flipping vertical (boolean): whether to apply vertical flipping
(self, prob=0.5, *, horizontal=True, vertical=False)
| 397 | """ |
| 398 | |
| 399 | def __init__(self, prob=0.5, *, horizontal=True, vertical=False): |
| 400 | """ |
| 401 | Args: |
| 402 | prob (float): probability of flip. |
| 403 | horizontal (boolean): whether to apply horizontal flipping |
| 404 | vertical (boolean): whether to apply vertical flipping |
| 405 | """ |
| 406 | super().__init__() |
| 407 | |
| 408 | if horizontal and vertical: |
| 409 | raise ValueError("Cannot do both horiz and vert. Please use two Flip instead.") |
| 410 | if not horizontal and not vertical: |
| 411 | raise ValueError("At least one of horiz or vert has to be True!") |
| 412 | self._init(locals()) |
| 413 | |
| 414 | def get_transform(self, image): |
| 415 | h, w = image.shape[:2] |