(image, boxes)
| 178 | |
| 179 | |
| 180 | def _mirror(image, boxes): |
| 181 | _, width, _ = image.shape |
| 182 | if random.randrange(2): |
| 183 | image = image[:, ::-1] |
| 184 | boxes = boxes.copy() |
| 185 | boxes[:, 0::2] = width - boxes[:, 2::-2] |
| 186 | return image, boxes |
| 187 | |
| 188 | |
| 189 | def preproc(image, input_size, mean, std, swap=(2, 0, 1)): |