MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / process_bbox

Function process_bbox

util/preprocessing.py:95–109  ·  view source on GitHub ↗
(bbox, img_width, img_height, ratio=1.)

Source from the content-addressed store, hash-verified

93 return size
94
95def 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
112def get_aug_config(data_name):

Callers 3

load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90

Calls 1

sanitize_bboxFunction · 0.85

Tested by

no test coverage detected