fix pad_param when scale_factor > 1 (#1395)

pull/1398/head
hanrui1sensetime 2022-11-18 19:40:39 +08:00 committed by GitHub
parent a10b9e964b
commit 2b2fe26b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -222,8 +222,10 @@ class End2EndModel(BaseBackendModel):
elif 'border' in img_metas[i]:
pad_key = 'border'
if pad_key is not None:
x_off = img_metas[i][pad_key][2]
y_off = img_metas[i][pad_key][0]
scale_factor = img_metas[i].get('scale_factor',
np.array([1., 1.]))
x_off = img_metas[i][pad_key][2] / scale_factor[1]
y_off = img_metas[i][pad_key][0] / scale_factor[0]
bboxes[:, ::2] -= x_off
bboxes[:, 1::2] -= y_off
bboxes *= (bboxes > 0)