parameters: (im_size, text_polys, text_tags, training_mask, i, n, m)
return_statement: return score_map, training_mask
docstring: 生成mask图，白色部分是文本，黑色是背景
      :param im_size: 图像的h,w
      :param text_polys: 框的坐标
      :param text_tags: 标注文本框是否参与训练
      :return: 生成的mask图
docstring_summary: 生成mask图，白色部分是文本，黑色是背景
      :param im_size: 图像的h,w
      :param text_polys: 框的坐标
      :param text_tags: 标注文本框是否参与训练
      :return: 生成的mask图
docstring_tokens: 生成mask图，白色部分是文本，黑色是背景 : param im_size : 图像的h w : param text_polys : 框的坐标 : param text_tags : 标注文本框是否参与训练 : return : 生成的mask图
function: def generate_rbox(im_size, text_polys, text_tags, training_mask, i, n, m):
      """
      生成mask图，白色部分是文本，黑色是背景
      :param im_size: 图像的h,w
      :param text_polys: 框的坐标
      :param text_tags: 标注文本框是否参与训练
      :return: 生成的mask图
      """
      h, w = im_size
      score_map = np.zeros((h, w), dtype=np.uint8)
      for poly, tag in zip(text_polys, text_tags):
          poly = poly.astype(np.int)
          r_i = 1 - (1 - m) * (n - i) / (n - 1)
          d_i = cv2.contourArea(poly) * (1 - r_i * r_i) / cv2.arcLength(poly, True)
          pco = pyclipper.PyclipperOffset()
          # pco.AddPath(pyclipper.scale_to_clipper(poly), pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
          # shrinked_poly = np.floor(np.array(pyclipper.scale_from_clipper(pco.Execute(-d_i)))).astype(np.int)
          pco.AddPath(poly, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
          shrinked_poly = np.array(pco.Execute(-d_i))
          cv2.fillPoly(score_map, shrinked_poly, 1)
          # 制作mask
          # rect = cv2.minAreaRect(shrinked_poly)
          # poly_h, poly_w = rect[1]
  
          # if min(poly_h, poly_w) < 10:
          #     cv2.fillPoly(training_mask, shrinked_poly, 0)
          if tag:
              cv2.fillPoly(training_mask, shrinked_poly, 0)
          # 闭运算填充内部小框
          # kernel = np.ones((3, 3), np.uint8)
          # score_map = cv2.morphologyEx(score_map, cv2.MORPH_CLOSE, kernel)
      return score_map, training_mask
function_tokens: def generate_rbox ( im_size , text_polys , text_tags , training_mask , i , n , m ) : h , w = im_size score_map = np . zeros ( ( h , w ) , dtype = np . uint8 ) for poly , tag in zip ( text_polys , text_tags ) : poly = poly . astype ( np . int ) r_i = 1 - ( 1 - m ) * ( n - i ) / ( n - 1 ) d_i = cv2 . contourArea ( poly ) * ( 1 - r_i * r_i ) / cv2 . arcLength ( poly , True ) pco = pyclipper . PyclipperOffset ( ) # pco.AddPath(pyclipper.scale_to_clipper(poly), pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON) # shrinked_poly = np.floor(np.array(pyclipper.scale_from_clipper(pco.Execute(-d_i)))).astype(np.int) pco . AddPath ( poly , pyclipper . JT_ROUND , pyclipper . ET_CLOSEDPOLYGON ) shrinked_poly = np . array ( pco . Execute ( - d_i ) ) cv2 . fillPoly ( score_map , shrinked_poly , 1 ) # 制作mask # rect = cv2.minAreaRect(shrinked_poly) # poly_h, poly_w = rect[1] # if min(poly_h, poly_w) < 10: #     cv2.fillPoly(training_mask, shrinked_poly, 0) if tag : cv2 . fillPoly ( training_mask , shrinked_poly , 0 ) # 闭运算填充内部小框 # kernel = np.ones((3, 3), np.uint8) # score_map = cv2.morphologyEx(score_map, cv2.MORPH_CLOSE, kernel) return score_map , training_mask