diff --git a/utils/callbacks.py b/utils/callbacks.py index a703585e5c101318bb2d35206cccfab208dc6ae5..b866781442081876c9127500b38e4f279e3d6f68 100644 --- a/utils/callbacks.py +++ b/utils/callbacks.py @@ -148,9 +148,9 @@ class EvalCallback(): top_label = np.array(results[0][:, 7], dtype = 'int32') top_conf = results[0][:, 5] * results[0][:, 6] top_rboxes = results[0][:, :5] - top_rboxes[:, [0, 2]] *= image_shape[1] - top_rboxes[:, [1, 3]] *= image_shape[0] top_polys = rbox2poly(top_rboxes) + top_polys[:, 0::2] *= image_shape[1] + top_polys[:, 1::2] *= image_shape[0] top_hbbs = poly2hbb(top_polys) top_100 = np.argsort(top_conf)[::-1][:self.max_boxes] top_hbbs = top_hbbs[top_100] diff --git a/yolo.py b/yolo.py index 28bb9ddfaaa6462ad59a8c8c9cf19d4b25b366aa..d538f5827f410c1c17febb009aa1a130b576aa2a 100644 --- a/yolo.py +++ b/yolo.py @@ -157,9 +157,9 @@ class YOLO(object): top_label = np.array(results[0][:, 7], dtype = 'int32') top_conf = results[0][:, 5] * results[0][:, 6] top_rboxes = results[0][:, :5] - top_rboxes[:, [0, 2]] *= image_shape[1] - top_rboxes[:, [1, 3]] *= image_shape[0] top_polys = rbox2poly(top_rboxes) + top_polys[:, 0::2] *= image_shape[1] + top_polys[:, 1::2] *= image_shape[0] #---------------------------------------------------------# # 设置字体与边框厚度 #---------------------------------------------------------# @@ -378,9 +378,9 @@ class YOLO(object): top_label = np.array(results[0][:, 7], dtype = 'int32') top_conf = results[0][:, 5] * results[0][:, 6] top_rboxes = results[0][:, :5] - top_rboxes[:, [0, 2]] *= image_shape[1] - top_rboxes[:, [1, 3]] *= image_shape[0] top_polys = rbox2poly(top_rboxes) + top_polys[:, 0::2] *= image_shape[1] + top_polys[:, 1::2] *= image_shape[0] top_hbbs = poly2hbb(top_polys) for i, c in list(enumerate(top_label)): predicted_class = self.class_names[int(c)]