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

avoid zero division in bbox2loc #459

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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