Crop the boxes given the offsets. Args: boxes (array): boxes to crop. x_offset (int): offset on x. y_offset (int): offset on y.
(boxes, x_offset, y_offset)
| 379 | |
| 380 | |
| 381 | def crop_boxes(boxes, x_offset, y_offset): |
| 382 | """ |
| 383 | Crop the boxes given the offsets. |
| 384 | Args: |
| 385 | boxes (array): boxes to crop. |
| 386 | x_offset (int): offset on x. |
| 387 | y_offset (int): offset on y. |
| 388 | """ |
| 389 | boxes[:, [0, 2]] = boxes[:, [0, 2]] - x_offset |
| 390 | boxes[:, [1, 3]] = boxes[:, [1, 3]] - y_offset |
| 391 | return boxes |
| 392 | |
| 393 | |
| 394 | def random_crop_list(images, size, pad_size=0, order="CHW", boxes=None): |