parameters: (im_fn: str, text_polys: np.ndarray, text_tags: list, n: int, m: float, input_size: int,
                  defrees: int = 10,
                  scales: np.ndarray = np.array([0.5, 1, 2.0, 3.0]))
return_statement: return imgs[0], imgs[1].transpose((2, 0, 1)), imgs[2]
docstring: get image's corresponding matrix and ground truth
      return
      images [512, 512, 3]
      score  [128, 128, 1]
      geo    [128, 128, 5]
      mask   [128, 128, 1]
docstring_summary: get image's corresponding matrix and ground truth
      return
      images [512, 512, 3]
      score  [128, 128, 1]
      geo    [128, 128, 5]
      mask   [128, 128, 1]
docstring_tokens: get image s corresponding matrix and ground truth return images [ 512 512 3 ] score [ 128 128 1 ] geo [ 128 128 5 ] mask [ 128 128 1 ]
function: def image_label(im_fn: str, text_polys: np.ndarray, text_tags: list, n: int, m: float, input_size: int,
                  defrees: int = 10,
                  scales: np.ndarray = np.array([0.5, 1, 2.0, 3.0])) -> tuple:
      '''
      get image's corresponding matrix and ground truth
      return
      images [512, 512, 3]
      score  [128, 128, 1]
      geo    [128, 128, 5]
      mask   [128, 128, 1]
      '''
  
      im = cv2.imread(im_fn)
      im = cv2.cvtColor(im,cv2.COLOR_BGR2RGB)
      h, w, _ = im.shape
      # 检查越界
      text_polys = check_and_validate_polys(text_polys, (h, w))
      im, text_polys, = augmentation(im, text_polys, scales, defrees, input_size)
  
      h, w, _ = im.shape
      short_edge = min(h, w)
      if short_edge < input_size:
          # 保证短边 >= inputsize
          scale = input_size / short_edge
          im = cv2.resize(im, dsize=None, fx=scale, fy=scale)
          text_polys *= scale
  
      # # normal images
      # im = im.astype(np.float32)
      # im /= 255.0
      # im -= np.array((0.485, 0.456, 0.406))
      # im /= np.array((0.229, 0.224, 0.225))
  
      h, w, _ = im.shape
      training_mask = np.ones((h, w), dtype=np.uint8)
      score_maps = []
      for i in range(1, n + 1):
          # s1->sn,由小到大
          score_map, training_mask = generate_rbox((h, w), text_polys, text_tags, training_mask, i, n, m)
          score_maps.append(score_map)
      score_maps = np.array(score_maps, dtype=np.float32)
      imgs = data_aug.random_crop_author([im, score_maps.transpose((1, 2, 0)),training_mask], (input_size, input_size))
      return imgs[0], imgs[1].transpose((2, 0, 1)), imgs[2]
function_tokens: def image_label ( im_fn : str , text_polys : np . ndarray , text_tags : list , n : int , m : float , input_size : int , defrees : int = 10 , scales : np . ndarray = np . array ( [ 0.5 , 1 , 2.0 , 3.0 ] ) ) -> tuple : im = cv2 . imread ( im_fn ) im = cv2 . cvtColor ( im , cv2 . COLOR_BGR2RGB ) h , w , _ = im . shape # 检查越界 text_polys = check_and_validate_polys ( text_polys , ( h , w ) ) im , text_polys , = augmentation ( im , text_polys , scales , defrees , input_size ) h , w , _ = im . shape short_edge = min ( h , w ) if short_edge < input_size : # 保证短边 >= inputsize scale = input_size / short_edge im = cv2 . resize ( im , dsize = None , fx = scale , fy = scale ) text_polys *= scale # # normal images # im = im.astype(np.float32) # im /= 255.0 # im -= np.array((0.485, 0.456, 0.406)) # im /= np.array((0.229, 0.224, 0.225)) h , w , _ = im . shape training_mask = np . ones ( ( h , w ) , dtype = np . uint8 ) score_maps = [ ] for i in range ( 1 , n + 1 ) : # s1->sn,由小到大 score_map , training_mask = generate_rbox ( ( h , w ) , text_polys , text_tags , training_mask , i , n , m ) score_maps . append ( score_map ) score_maps = np . array ( score_maps , dtype = np . float32 ) imgs = data_aug . random_crop_author ( [ im , score_maps . transpose ( ( 1 , 2 , 0 ) ) , training_mask ] , ( input_size , input_size ) ) return imgs [ 0 ] , imgs [ 1 ] . transpose ( ( 2 , 0 , 1 ) ) , imgs [ 2 ]