From 6aae5aca64e153afd24446c55f619613f5a62c27 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 13 Mar 2020 10:47:00 -0700 Subject: [PATCH] inplace clip_coords() clamp --- utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index 9fb0d0e5..5b9d4b43 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -160,8 +160,8 @@ def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None): def clip_coords(boxes, img_shape): # Clip bounding xyxy bounding boxes to image shape (height, width) - boxes[:, [0, 2]] = boxes[:, [0, 2]].clamp(min=0, max=img_shape[1]) # clip x - boxes[:, [1, 3]] = boxes[:, [1, 3]].clamp(min=0, max=img_shape[0]) # clip y + boxes[:, [0, 2]].clamp_(0, img_shape[1]) # clip x + boxes[:, [1, 3]].clamp_(0, img_shape[0]) # clip y def ap_per_class(tp, conf, pred_cls, target_cls):