Skip to content

Commit

Permalink
Check for bounding box coordinates for Yolo
Browse files Browse the repository at this point in the history
Suggested fix for cvat-ai#896
  • Loading branch information
himalayanZephyr committed Dec 6, 2019
1 parent c0f1854 commit bb8c68d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions utils/open_model_zoo/yolov3/interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,11 @@ def parse_yolo_region(self, blob: 'np.ndarray', original_shape: list, params: di
xmax = obj['xmax']
ymin = obj['ymin']
ymax = obj['ymax']

# Enforcing checks
xmin = max(0,xmin)
ymin = max(0,ymin)
xmax = min(xmax,width)
ymax = min(ymax,height)

results.add_box(xmin, ymin, xmax, ymax, label, frame_number)

0 comments on commit bb8c68d

Please sign in to comment.