(img)
| 153 | rot90 = rotation and random.random() < 0.5 |
| 154 | |
| 155 | def _augment(img): |
| 156 | if hflip: # horizontal |
| 157 | cv2.flip(img, 1, img) |
| 158 | if vflip: # vertical |
| 159 | cv2.flip(img, 0, img) |
| 160 | if rot90: |
| 161 | img = img.transpose(1, 0, 2) |
| 162 | return img |
| 163 | |
| 164 | def _augment_flow(flow): |
| 165 | if hflip: # horizontal |