docstr: # 1. transform chip dets to image dets
  # 2. nms boxes per image;
  # 3. format output results
  :param results:
  :param roidb:
  :return:
docstr_tok: ["#","1.","transform","chip","dets","to","image","dets","#","2.","nms","boxes","per","image",";","#","3.","format","output","results",":","param","results",":",":","param","roidb",":",":","return",":"]
code: def aggregate_chips_detections(self, results, records=None):
      """
      # 1. transform chip dets to image dets
      # 2. nms boxes per image;
      # 3. format output results
      :param results:
      :param roidb:
      :return:
      """
      results = deepcopy(results)
      records = records if records else self.chip_records
      img_id2bbox = self._transform_chip2image_bboxes(results, records)
      nms_img_id2bbox = self._nms_dets(img_id2bbox)
      aggregate_results = self._reformat_results(nms_img_id2bbox)
      return aggregate_results
  
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 21 for calling the AnnoCropper obj's underlying member method code with example usage: obj.aggregate_chips_detections(results, records) and returns: aggregate_results