From 5164dfd267bff8f598349475e74a8d7c92f377ec Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Sat, 20 Feb 2021 19:59:32 +0800 Subject: [PATCH] fix icafe 21567: DIoULossYolo passing parameters problem (#2159) --- ppdet/modeling/losses/diou_loss_yolo.py | 3 ++- ppdet/modeling/losses/yolo_loss.py | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ppdet/modeling/losses/diou_loss_yolo.py b/ppdet/modeling/losses/diou_loss_yolo.py index d85154d08..9d83eecde 100644 --- a/ppdet/modeling/losses/diou_loss_yolo.py +++ b/ppdet/modeling/losses/diou_loss_yolo.py @@ -54,7 +54,8 @@ class DiouLossYolo(IouLoss): anchors, downsample_ratio, batch_size, - eps=1.e-10): + eps=1.e-10, + **kwargs): ''' Args: x | y | w | h ([Variables]): the output of yolov3 for encoded x|y|w|h diff --git a/ppdet/modeling/losses/yolo_loss.py b/ppdet/modeling/losses/yolo_loss.py index 9445f6a23..c16c6cb11 100644 --- a/ppdet/modeling/losses/yolo_loss.py +++ b/ppdet/modeling/losses/yolo_loss.py @@ -180,9 +180,19 @@ class YOLOv3Loss(object): loss_h = fluid.layers.abs(h - th) * tscale_tobj loss_h = fluid.layers.reduce_sum(loss_h, dim=[1, 2, 3]) if self._iou_loss is not None: - loss_iou = self._iou_loss(x, y, w, h, tx, ty, tw, th, anchors, - downsample, self._train_batch_size, - scale_x_y) + loss_iou = self._iou_loss( + x, + y, + w, + h, + tx, + ty, + tw, + th, + anchors, + downsample, + self._train_batch_size, + scale_x_y=scale_x_y) loss_iou = loss_iou * tscale_tobj loss_iou = fluid.layers.reduce_sum(loss_iou, dim=[1, 2, 3]) loss_ious.append(fluid.layers.reduce_mean(loss_iou)) -- GitLab