docstr: Load pre-saved official CRAFT model's region, affinity scores to train
  word_level_char_bbox's shape : [word_num, [char_num_in_one_word, 4, 2]]
  :rtype region_score: np.float32
  :rtype affinity_score: np.float32
  :rtype confidence_mask: np.float32
  :rtype word_level_char_bbox: np.float32
  :rtype words: list
docstr_tok: ["Load","pre-saved","official","CRAFT","model","'s","region",",","affinity","scores","to","train","word_level_char_bbox","'s","shape",":","[","word_num",",","[","char_num_in_one_word",",","4",",","2","]","]",":","rtype","region_score",":","np.float32",":","rtype","affinity_score",":","np.float32",":","rtype","confidence_mask",":","np.float32",":","rtype","word_level_char_bbox",":","np.float32",":","rtype","words",":","list"]
code: def load_saved_gt_score(self, index):
      """
      Load pre-saved official CRAFT model's region, affinity scores to train
      word_level_char_bbox's shape : [word_num, [char_num_in_one_word, 4, 2]]
      :rtype region_score: np.float32
      :rtype affinity_score: np.float32
      :rtype confidence_mask: np.float32
      :rtype word_level_char_bbox: np.float32
      :rtype words: list
      """
      img_name = self.img_names[index]
      img_path = os.path.join(self.img_dir, img_name)
      image = cv2.imread(img_path)
      image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
  
      img_gt_box_path = os.path.join(
          self.img_gt_box_dir,
          "gt_%s.txt" % os.path.splitext(img_name)[0],
      )
      word_bboxes, words = self.load_img_gt_box(img_gt_box_path)
      image, word_bboxes = rescale(image, word_bboxes)
      img_h, img_w, _ = image.shape
  
      query_idx = int(self.img_names[index].split(".")[0].split("_")[1])
  
      saved_region_scores_path = os.path.join(
          self.saved_gt_dir, f"res_img_{query_idx}_region.jpg"
      )
      saved_affi_scores_path = os.path.join(
          self.saved_gt_dir, f"res_img_{query_idx}_affi.jpg"
      )
      saved_cf_mask_path = os.path.join(
          self.saved_gt_dir,
          f"res_img_{query_idx}_cf_mask_thresh_0.6.jpg",
      )
      region_score = cv2.imread(
          saved_region_scores_path, cv2.IMREAD_GRAYSCALE
      )
      affinity_score = cv2.imread(
          saved_affi_scores_path, cv2.IMREAD_GRAYSCALE
      )
      confidence_mask = cv2.imread(
          saved_cf_mask_path, cv2.IMREAD_GRAYSCALE
      )
  
      region_score = cv2.resize(region_score, (img_w, img_h))
      affinity_score = cv2.resize(affinity_score, (img_w, img_h))
      confidence_mask = cv2.resize(
          confidence_mask,
          (img_w, img_h),
          interpolation=cv2.INTER_NEAREST,
      )
  
      region_score = region_score.astype(np.float32) / 255
      affinity_score = affinity_score.astype(np.float32) / 255
      confidence_mask = confidence_mask.astype(np.float32) / 255
  
      # NOTE : Even though word_level_char_bbox is not necessary, align bbox format with make_gt_score()
      word_level_char_bbox = []
  
      for i in range(len(word_bboxes)):
          word_level_char_bbox.append(np.expand_dims(word_bboxes[i], 0))
  
      return (
          image,
          region_score,
          affinity_score,
          confidence_mask,
          word_level_char_bbox,
          words,
      )
  
imports: import os
  import re
  import itertools
  import random
  import numpy
  import scipy.io
  from PIL import Image
  import cv2
  from torch.utils.data import Dataset
  import torchvision.transforms
  from data import imgproc
  from data.gaussian import GaussianBuilder
  from data.imgaug import rescale, random_resize_crop_synth, random_resize_crop, random_horizontal_flip, random_rotate, random_scale, random_crop
  from data.pseudo_label.make_charbox import PseudoCharBoxBuilder
  from utils.util import saveInput, saveImage
label_desc: Use image node_id 7 for calling the CustomDataset obj's underlying member method code with example usage: obj.load_saved_gt_score(index) and returns: image,  region_score,  affinity_score,  confidence_mask,  word_level_char_bbox,  words