(box, scale)
| 42 | |
| 43 | |
| 44 | def _scale_box(box, scale): |
| 45 | w_half = (box[2] - box[0]) * 0.5 |
| 46 | h_half = (box[3] - box[1]) * 0.5 |
| 47 | x_c = (box[2] + box[0]) * 0.5 |
| 48 | y_c = (box[3] + box[1]) * 0.5 |
| 49 | |
| 50 | w_half *= scale |
| 51 | h_half *= scale |
| 52 | |
| 53 | scaled_box = np.zeros_like(box) |
| 54 | scaled_box[0] = x_c - w_half |
| 55 | scaled_box[2] = x_c + w_half |
| 56 | scaled_box[1] = y_c - h_half |
| 57 | scaled_box[3] = y_c + h_half |
| 58 | return scaled_box |
| 59 | |
| 60 | |
| 61 | def _paste_mask(box, mask, shape): |