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

Function process_bbox

HMR-Scorer/common/utils/preprocessing.py:61–86  ·  view source on GitHub ↗

保持检测框中心点位置不变调整检测框比例为cfg.input_img_size ration: 扩大检测框大小

(bbox, img_width, img_height, ratio=1.25)

Source from the content-addressed store, hash-verified

59
60
61def process_bbox(bbox, img_width, img_height, ratio=1.25):
62 '''
63 保持检测框中心点位置不变调整检测框比例为cfg.input_img_size
64
65 ration: 扩大检测框大小'''
66 bbox = sanitize_bbox(bbox, img_width, img_height)
67 if bbox is None:
68 return bbox
69
70 # aspect ratio preserving bbox
71 w = bbox[2]
72 h = bbox[3]
73 c_x = bbox[0] + w / 2.
74 c_y = bbox[1] + h / 2.
75 aspect_ratio = cfg.input_img_shape[1] / cfg.input_img_shape[0]
76 if w > aspect_ratio * h:
77 h = w / aspect_ratio
78 elif w < aspect_ratio * h:
79 w = h * aspect_ratio
80 bbox[2] = w * ratio
81 bbox[3] = h * ratio
82 bbox[0] = c_x - bbox[2] / 2.
83 bbox[1] = c_y - bbox[3] / 2.
84
85 bbox = bbox.astype(np.float32)
86 return bbox
87
88
89def get_aug_config():

Callers 7

load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90
load_dataMethod · 0.90

Calls 1

sanitize_bboxFunction · 0.70

Tested by 1

load_dataMethod · 0.72