Skip to content

Commit

Permalink
Add nmsi
Browse files Browse the repository at this point in the history
  • Loading branch information
ericup committed Dec 1, 2022
1 parent 7b6017a commit 1332add
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions celldetection/ops/cpn.py
Expand Up @@ -178,6 +178,17 @@ def batched_box_nms(
return (cons, scos) + tuple(further)


def batched_box_nmsi(
boxes: List[Tensor], scores: List[Tensor], iou_threshold: float
) -> List[Tensor]:
assert len(scores) == len(boxes)
keeps = []
for con, sco in zip(boxes, scores):
indices = torch.ops.torchvision.nms(con, sco, iou_threshold=iou_threshold)
keeps.append(indices)
return keeps


def order_weighting(order, max_w=5, min_w=1, spread=None) -> torch.Tensor:
x = torch.arange(order).float()
if spread is None:
Expand Down

0 comments on commit 1332add

Please sign in to comment.