diff --git a/chainercv/links/model/faster_rcnn/utils/bbox2loc.py b/chainercv/links/model/faster_rcnn/utils/bbox2loc.py index 94ebe6c385..4ce52f2df9 100644 --- a/chainercv/links/model/faster_rcnn/utils/bbox2loc.py +++ b/chainercv/links/model/faster_rcnn/utils/bbox2loc.py @@ -54,6 +54,10 @@ def bbox2loc(src_bbox, dst_bbox): base_ctr_y = dst_bbox[:, 0] + 0.5 * base_height base_ctr_x = dst_bbox[:, 1] + 0.5 * base_width + eps = xp.finfo(height.dtype).eps + height = xp.maximum(height, eps) + width = xp.maximum(width, eps) + dy = (base_ctr_y - ctr_y) / height dx = (base_ctr_x - ctr_x) / width dh = xp.log(base_height / height)