Skip to content

Commit

Permalink
Add NMS threshold checks (#3020)
Browse files Browse the repository at this point in the history
* Add NMS threshold checks

* fix
  • Loading branch information
glenn-jocher authored May 3, 2021
1 parent fcd5702 commit 41cc7ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
nc = prediction.shape[2] - 5 # number of classes
xc = prediction[..., 4] > conf_thres # candidates

# Checks
assert 0 <= conf_thres <= 1, f'Invalid Confidence threshold {conf_thres}, valid values are between 0.0 and 1.0'
assert 0 <= iou_thres <= 1, f'Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0'

# Settings
min_wh, max_wh = 2, 4096 # (pixels) minimum and maximum box width and height
max_det = 300 # maximum number of detections per image
Expand Down

0 comments on commit 41cc7ca

Please sign in to comment.