docstr: Generate chips by chip_target_size and chip_target_stride.
  These two parameters just like kernel_size and stride in cnn.
  
  Each image has its raw size. After resizing, then get its target size.
  The resizing scale = target_size / raw_size.
  So are chips of the image.
  box_ratio = box_raw_size / image_raw_size = box_target_size / image_target_size
  The 'size' above mentioned is the size of long-side of image, box or chip.
  
  :param image_target_sizes: [2000, 1000]
  :param valid_box_ratio_ranges:  [[-1, 0.1],[0.08, -1]]
  :param chip_target_size: 500
  :param chip_target_stride: 200
docstr_tok: ["Generate","chips","by","chip_target_size","and","chip_target_stride",".","These","two","parameters","just","like","kernel_size","and","stride","in","cnn",".","Each","image","has","its","raw","size",".","After","resizing",",","then","get","its","target","size",".","The","resizing","scale","=","target_size","\/","raw_size",".","So","are","chips","of","the","image",".","box_ratio","=","box_raw_size","\/","image_raw_size","=","box_target_size","\/","image_target_size","The","'size","'","above","mentioned","is","the","size","of","long-side","of","image",",","box","or","chip",".",":","param","image_target_sizes",":","[","2000",",","1000","]",":","param","valid_box_ratio_ranges",":","[","[","-1",",","0.1","]",",","[","0.08",",","-1","]","]",":","param","chip_target_size",":","500",":","param","chip_target_stride",":","200"]
code: def __init__(
      self,
      image_target_sizes: List[int],
      valid_box_ratio_ranges: List[List[float]],
      chip_target_size: int,
      chip_target_stride: int,
      use_neg_chip: bool = False,
      max_neg_num_per_im: int = 8,
      max_per_img: int = -1,
      nms_thresh: int = 0.5,
  ):
      """
      Generate chips by chip_target_size and chip_target_stride.
      These two parameters just like kernel_size and stride in cnn.
  
      Each image has its raw size. After resizing, then get its target size.
      The resizing scale = target_size / raw_size.
      So are chips of the image.
      box_ratio = box_raw_size / image_raw_size = box_target_size / image_target_size
      The 'size' above mentioned is the size of long-side of image, box or chip.
  
      :param image_target_sizes: [2000, 1000]
      :param valid_box_ratio_ranges:  [[-1, 0.1],[0.08, -1]]
      :param chip_target_size: 500
      :param chip_target_stride: 200
      """
      self.target_sizes = image_target_sizes
      self.valid_box_ratio_ranges = valid_box_ratio_ranges
      assert len(self.target_sizes) == len(self.valid_box_ratio_ranges)
      self.scale_num = len(self.target_sizes)
      self.chip_target_size = chip_target_size  # is target size
      self.chip_target_stride = chip_target_stride  # is target stride
      self.use_neg_chip = use_neg_chip
      self.max_neg_num_per_im = max_neg_num_per_im
      self.max_per_img = max_per_img
      self.nms_thresh = nms_thresh
  
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 1 to create a new AnnoCropper object from inherited base classes: object with example: obj = AnnoCropper(image_target_sizes, valid_box_ratio_ranges, chip_target_size, chip_target_stride, use_neg_chip, max_neg_num_per_im, max_per_img, nms_thresh)