code: def _nms_dets(self, img_id2bbox):
      # 1. NMS on each image-class
      # 2. Limit number of detections to MAX_PER_IMAGE if requested
      max_per_img = self.max_per_img
      nms_thresh = self.nms_thresh
  
      for img_id in img_id2bbox:
          box = img_id2bbox[
              img_id
          ]  # list of np.array of shape [N, 6], 6 is [label, score, x1, y1, x2, y2]
          box = np.concatenate(box, axis=0)
          nms_dets = nms(box, nms_thresh)
          if max_per_img > 0:
              if len(nms_dets) > max_per_img:
                  keep = np.argsort(-nms_dets[:, 1])[:max_per_img]
                  nms_dets = nms_dets[keep]
  
          img_id2bbox[img_id] = nms_dets
  
      return img_id2bbox
  
imports: import copy
  import math
  import random
  import numpy
  from copy import deepcopy
  from typing import List, Tuple
  from collections import defaultdict
  from .chip_box_utils import nms, transform_chip_boxes2image_boxes
  from .chip_box_utils import find_chips_to_cover_overlaped_boxes
  from .chip_box_utils import transform_chip_box
  from .chip_box_utils import intersection_over_box
label_desc: Use image node_id 23 for calling the AnnoCropper obj's underlying member method code with example usage: obj._nms_dets(img_id2bbox) and returns: img_id2bbox