code: def _trans_all_chips2annotations(self, r):
      gt_bbox = r["gt_bbox"]
      im_file = r["im_file"]
      is_crowd = r["is_crowd"]
      gt_class = r["gt_class"]
      # gt_poly = r['gt_poly']   # [None]xN
      # remaining keys: im_id, h, w
      chip_records = self._trans_pos_chips2annotations(
          im_file, gt_bbox, is_crowd, gt_class
      )
  
      if not self.use_neg_chip:
          return chip_records
  
      sampled_neg_chips = self._sample_neg_chips()
      neg_chip_records = self._trans_neg_chips2annotations(
          im_file, sampled_neg_chips
      )
      chip_records.extend(neg_chip_records)
      return chip_records
  
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 4 for calling the AnnoCropper obj's underlying member method code with example usage: obj._trans_all_chips2annotations(r) and returns: chip_records, chip_records