code: def build_char_box(
      self, net, gpu, image, word_bbox, word, img_name=""
  ):
      word_image, M, horizontal_text_bool = self.crop_image_by_bbox(
          image, word_bbox, word
      )
      real_word_without_space = word.replace("\s", "")
      real_char_len = len(real_word_without_space)
  
      scale = 128.0 / word_image.shape[0]
  
      word_image = cv2.resize(word_image, None, fx=scale, fy=scale)
      word_img_h, word_img_w, _ = word_image.shape
  
      scores = self.inference_word_box(net, gpu, word_image)
      region_score = scores[0, :, :, 0].cpu().data.numpy()
      region_score = np.uint8(np.clip(region_score, 0, 1) * 255)
  
      region_score_rgb = cv2.resize(
          region_score, (word_img_w, word_img_h)
      )
      region_score_rgb = cv2.cvtColor(
          region_score_rgb, cv2.COLOR_GRAY2RGB
      )
  
      pseudo_char_bbox = exec_watershed_by_version(
          self.watershed_param,
          region_score,
          word_image,
          self.pseudo_vis_opt,
      )
  
      # Used for visualize only
      watershed_box = pseudo_char_bbox.copy()
  
      pseudo_char_bbox = self.clip_into_boundary(
          pseudo_char_bbox, region_score_rgb.shape
      )
  
      confidence = self.get_confidence(
          real_char_len, len(pseudo_char_bbox)
      )
  
      if confidence <= 0.5:
          pseudo_char_bbox = self.split_word_equal_gap(
              word_img_w, word_img_h, word
          )
          confidence = 0.5
  
      if self.pseudo_vis_opt and self.flag:
          self.visualize_pseudo_label(
              word_image,
              region_score,
              watershed_box,
              pseudo_char_bbox,
              img_name,
          )
  
      if len(pseudo_char_bbox) != 0:
          index = np.argsort(pseudo_char_bbox[:, 0, 0])
          pseudo_char_bbox = pseudo_char_bbox[index]
  
      pseudo_char_bbox /= scale
  
      M_inv = np.linalg.pinv(M)
      for i in range(len(pseudo_char_bbox)):
          pseudo_char_bbox[i] = cv2.perspectiveTransform(
              pseudo_char_bbox[i][None, :, :], M_inv
          )
  
      pseudo_char_bbox = self.clip_into_boundary(
          pseudo_char_bbox, image.shape
      )
  
      return pseudo_char_bbox, confidence, horizontal_text_bool
  
file_path: EasyOCR/trainer/craft/data/pseudo_label/make_charbox.py
imports: import os
  import random
  import math
  import numpy
  import cv2
  import torch
  from data import imgproc
  from data.pseudo_label.watershed import exec_watershed_by_version
label_desc: Use image node_id 10 for calling the PseudoCharBoxBuilder obj's underlying member method code with example usage: obj.build_char_box(net, gpu, image, word_bbox, word, img_name) and returns: pseudo_char_bbox,  confidence,  horizontal_text_bool