From 67fac117b0a2c514a0415274eab4e42a643540dd Mon Sep 17 00:00:00 2001 From: rock4you Date: Mon, 27 Jul 2020 10:44:51 +0800 Subject: [PATCH] Update iou_loss.py --- ppdet/modeling/losses/iou_loss.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/losses/iou_loss.py b/ppdet/modeling/losses/iou_loss.py index 624cd47c0..56532c868 100644 --- a/ppdet/modeling/losses/iou_loss.py +++ b/ppdet/modeling/losses/iou_loss.py @@ -100,8 +100,9 @@ class IouLoss(object): ykis2 = fluid.layers.elementwise_min(y2, y2g) intsctk = (xkis2 - xkis1) * (ykis2 - ykis1) - intsctk = intsctk * fluid.layers.greater_than( - xkis2, xkis1) * fluid.layers.greater_than(ykis2, ykis1) + intsctk = intsctk * + fluid.layers.cast(fluid.layers.greater_than(xkis2, xkis1), dtype = "float32") * + fluid.layers.cast(fluid.layers.greater_than(ykis2, ykis1), dtype = "float32") unionk = (x2 - x1) * (y2 - y1) + (x2g - x1g) * (y2g - y1g ) - intsctk + eps iouk = intsctk / unionk -- GitLab