未验证 提交 30185efd 编写于 作者: H Huihuang Zheng 提交者: GitHub

Add If-Else-Return of Yolov3 as Unittest (#25385)

As the title
上级 80f1c507
......@@ -314,21 +314,19 @@ class YOLOv3(fluid.dygraph.Layer):
scores, perm=[0, 2, 1]))
self.downsample //= 2
# TODO(liym27): Uncomment code after "return" statement can be transformed correctly.
# if not self.is_train:
# # get pred
# yolo_boxes = fluid.layers.concat(self.boxes, axis=1)
# yolo_scores = fluid.layers.concat(self.scores, axis=2)
#
# pred = fluid.layers.multiclass_nms(
# bboxes=yolo_boxes,
# scores=yolo_scores,
# score_threshold=cfg.valid_thresh,
# nms_top_k=cfg.nms_topk,
# keep_top_k=cfg.nms_posk,
# nms_threshold=cfg.nms_thresh,
# background_label=-1)
# return pred
# else:
# return sum(self.losses)
return sum(self.losses)
if not self.is_train:
# get pred
yolo_boxes = fluid.layers.concat(self.boxes, axis=1)
yolo_scores = fluid.layers.concat(self.scores, axis=2)
pred = fluid.layers.multiclass_nms(
bboxes=yolo_boxes,
scores=yolo_scores,
score_threshold=cfg.valid_thresh,
nms_top_k=cfg.nms_topk,
keep_top_k=cfg.nms_posk,
nms_threshold=cfg.nms_thresh,
background_label=-1)
return pred
else:
return sum(self.losses)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册