(bbox, img_width, img_height, ratio=1.)
| 93 | return size |
| 94 | |
| 95 | def process_bbox(bbox, img_width, img_height, ratio=1.): |
| 96 | |
| 97 | bbox = np.array(bbox, dtype=np.float32) |
| 98 | # aspect ratio preserving bbox |
| 99 | w = bbox[2] |
| 100 | h = bbox[3] |
| 101 | c_x = bbox[0] + w / 2. |
| 102 | c_y = bbox[1] + h / 2. |
| 103 | bbox[2] = w * ratio |
| 104 | bbox[3] = h * ratio |
| 105 | bbox[0] = c_x - bbox[2] / 2. |
| 106 | bbox[1] = c_y - bbox[3] / 2. |
| 107 | |
| 108 | bbox = sanitize_bbox(bbox, img_width, img_height) |
| 109 | return bbox |
| 110 | |
| 111 | |
| 112 | def get_aug_config(data_name): |
no test coverage detected