From 54f9797658f325065291f5007abb4919459d39d9 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Oct 2020 15:16:28 +0800 Subject: [PATCH] fix ssd gpu same loss value is inf --- model_zoo/official/cv/ssd/src/box_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model_zoo/official/cv/ssd/src/box_utils.py b/model_zoo/official/cv/ssd/src/box_utils.py index 5e75ab6a4eb..87688d72f20 100644 --- a/model_zoo/official/cv/ssd/src/box_utils.py +++ b/model_zoo/official/cv/ssd/src/box_utils.py @@ -124,7 +124,8 @@ def ssd_bboxes_encode(boxes): bboxes_t = bboxes[index] default_boxes_t = default_boxes[index] bboxes_t[:, :2] = (bboxes_t[:, :2] - default_boxes_t[:, :2]) / (default_boxes_t[:, 2:] * config.prior_scaling[0]) - bboxes_t[:, 2:4] = np.log(bboxes_t[:, 2:4] / default_boxes_t[:, 2:4]) / config.prior_scaling[1] + tmp = np.maximum(bboxes_t[:, 2:4] / default_boxes_t[:, 2:4], 0.000001) + bboxes_t[:, 2:4] = np.log(tmp) / config.prior_scaling[1] bboxes[index] = bboxes_t num_match = np.array([len(np.nonzero(t_label)[0])], dtype=np.int32)