consnet.api.bbox
- consnet.api.bbox.pair_iou(bboxes1, bboxes2)[source]
Compute the intersection-over-unions (IoUs) among human-object pairs.
- Parameters:
bboxes1 (
Tensor[N, 8]) – Human-object pairs to be computed. They are expected to be in(x1, y1, x2, y2, ...)format.bboxes2 (
Tensor[M, 8]) – Human-object pairs to be computed. They are expected to be in(x1, y1, x2, y2, ...)format.
- Returns:
The computed pairwise IoU values
- Return type:
Tensor[N, M]
- consnet.api.bbox.pair_nms(bboxes, scores, method='fast', hard_thr=0.5, soft_thr=0.3, sigma=0.5, score_thr=1e-06)[source]
Perform non-maximum suppression (NMS) on human-object pairs. This method supports multiple NMS types including Fast NMS [1], Cluster NMS [2], Normal NMS [3] and Soft NMS [4] with linear or gaussian suppression terms.
- Parameters:
bboxes (
Tensor[N, 9]) – Batches of human-object pairs to be suppressed. The values are expected to be in(batch_id, x1, y1, x2, y2, ...)format.scores (
Tensor[N]) – Human-object interaction detection scores to be considered.method (str, optional) – Type of NMS. Expected values include
'fast','cluster','normal','linear'and'gaussian', indicating Fast NMS, Cluster NMS, Normal NMS and Soft NMS with linear or gaussian suppression terms.hard_thr (float, optional) – Hard threshold of NMS. This attribute is applied to all NMS methods. Human-object pairs with IoUs higher than this value will be discarded.
soft_thr (float, optional) – Soft threshold of NMS. This attribute is only applied to
linearandgaussianmethods. Human-object pairs with IoUs lower thanhard_thrbut higher than this value will be suppressed in a soft manner.sigma (float, optional) – Hyperparameter for
gaussianmethod.score_thr (float, optional) – Score threshold. This attribute is applied to
normal,linearandgaussianmethods. Human-object pairs with suppressed scores lower than this value will be discarded.
- Returns:
Human-object pairs and their updated scores after NMS. The values are expected to be in
(batch_id, x1, y1, x2, y2, ..., score)format.- Return type:
Tensor[N, 10]
References
Bolya et al. (https://arxiv.org/abs/1904.02689)
Zheng et al. (https://arxiv.org/abs/2005.03572)
Neubeck er al. (https://doi.org/10.1109/icpr.2006.479)
Bodla et al. (https://arxiv.org/abs/1704.04503)