docstr: Generate chips by chip_target_size and chip_target_stride.
  These two parameters just like kernel_size and stride in cnn.
  :return: chips, Cx4, xy in raw size dimension
docstr_tok: ["Generate","chips","by","chip_target_size","and","chip_target_stride",".","These","two","parameters","just","like","kernel_size","and","stride","in","cnn",".",":","return",":","chips",",","Cx4",",","xy","in","raw","size","dimension"]
code: def _create_chips(self, h: int, w: int, scale: float):
      """
      Generate chips by chip_target_size and chip_target_stride.
      These two parameters just like kernel_size and stride in cnn.
      :return: chips, Cx4, xy in raw size dimension
      """
      chip_size = self.chip_target_size  # omit target for simplicity
      stride = self.chip_target_stride
      width = int(scale * w)
      height = int(scale * h)
      min_chip_location_diff = 20  # in target size
  
      assert chip_size >= stride
      chip_overlap = chip_size - stride
      if (
          width - chip_overlap
      ) % stride > min_chip_location_diff:  # 不能被stride整除的部分比较大，则保留
          w_steps = max(
              1, int(math.ceil((width - chip_overlap) / stride))
          )
      else:  # 不能被stride整除的部分比较小，则丢弃
          w_steps = max(
              1, int(math.floor((width - chip_overlap) / stride))
          )
      if (height - chip_overlap) % stride > min_chip_location_diff:
          h_steps = max(
              1, int(math.ceil((height - chip_overlap) / stride))
          )
      else:
          h_steps = max(
              1, int(math.floor((height - chip_overlap) / stride))
          )
  
      chips = list()
      for j in range(h_steps):
          for i in range(w_steps):
              x1 = i * stride
              y1 = j * stride
              x2 = min(x1 + chip_size, width)
              y2 = min(y1 + chip_size, height)
              chips.append([x1, y1, x2, y2])
  
      # check  chip size
      for item in chips:
          if (
              item[2] - item[0] > chip_size * 1.1
              or item[3] - item[1] > chip_size * 1.1
          ):
              raise ValueError(item)
      chips = np.array(chips, dtype=np.float32)
  
      raw_size_chips = chips / scale
      return raw_size_chips
  
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 10 for calling the AnnoCropper obj's underlying member method code with example usage: obj._create_chips(h, w, scale) and returns: raw_size_chips