Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #459 from knorth55/avoid-zero-division-bbox2loc
Browse files Browse the repository at this point in the history
avoid zero division in bbox2loc
  • Loading branch information
Hakuyume authored Oct 20, 2017
2 parents 2723ad4 + ecde69c commit 1b6314f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chainercv/links/model/faster_rcnn/utils/bbox2loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b6314f

Please sign in to comment.