nms {torchvision} | R Documentation |
Non-maximum Suppression (NMS)
Description
Performs non-maximum suppression (NMS) on the boxes according to their intersection-over-union (IoU). NMS iteratively removes lower scoring boxes which have an IoU greater than iou_threshold with another (higher scoring) box.
Usage
nms(boxes, scores, iou_threshold)
Arguments
boxes |
(Tensor[N, 4])): boxes to perform NMS on. They are
expected to be in
|
scores |
(Tensor[N]): scores for each one of the boxes |
iou_threshold |
(float): discards all overlapping boxes with IoU > iou_threshold |
Details
If multiple boxes have the exact same score and satisfy the IoU criterion with respect to a reference box, the selected box is not guaranteed to be the same between CPU and GPU. This is similar to the behavior of argsort in torch when repeated values are present.
Current algorithm has a time complexity of O(n^2) and runs in native R. It may be improve in the future by a Rcpp implementation or through alternative algorithm
Value
keep (Tensor): int64 tensor with the indices of the elements that have been kept by NMS, sorted in decreasing order of scores.