code: def nms_rotated(dets, scores, iou_threshold, labels=None):
      """Performs non-maximum suppression (NMS) on the rotated boxes according to
      their intersection-over-union (IoU).
  
      Rotated NMS iteratively removes lower scoring rotated boxes which have an
      IoU greater than iou_threshold with another (higher scoring) rotated box.
  
      Args:
          boxes (Tensor):  Rotated boxes in shape (N, 5). They are expected to \
              be in (x_ctr, y_ctr, width, height, angle_radian) format.
          scores (Tensor): scores in shape (N, ).
          iou_threshold (float): IoU thresh for NMS.
          labels (Tensor): boxes' label in shape (N,).
  
      Returns:
          tuple: kept dets(boxes and scores) and indice, which is always the \
              same data type as the input.
      """
      if dets.shape[0] == 0:
          return dets, None
      multi_label = labels is not None
      if multi_label:
          dets_wl = torch.cat((dets, labels.unsqueeze(1)), 1)
      else:
          dets_wl = dets
      _, order = scores.sort(0, descending=True)
      dets_sorted = dets_wl.index_select(0, order)
  
      if torch.__version__ == "parrots":
          keep_inds = ext_module.nms_rotated(
              dets_wl,
              scores,
              order,
              dets_sorted,
              iou_threshold=iou_threshold,
              multi_label=multi_label,
          )
      else:
          keep_inds = ext_module.nms_rotated(
              dets_wl,
              scores,
              order,
              dets_sorted,
              iou_threshold,
              multi_label,
          )
      dets = torch.cat(
          (dets[keep_inds], scores[keep_inds].reshape(-1, 1)), dim=1
      )
      return dets, keep_inds
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/ops/nms.py
imports: import os
  import numpy
  import torch
  from annotator.uniformer.mmcv.utils import deprecated_api_warning
  from ..utils import ext_loader
label_desc: Use image node_id 5 for calling a global function with example usage: nms_rotated(dets, scores, iou_threshold, labels) and returns: dets,  keep_inds, dets,  None