code: def save_outputs(
      image,
      region_scores,
      affinity_scores,
      text_threshold,
      link_threshold,
      low_text,
      outoput_path,
      confidence_mask=None,
  ):
      """save image, region_scores, and affinity_scores in a single image. region_scores and affinity_scores must be
      cpu numpy arrays. You can convert GPU Tensors to CPU numpy arrays like this:
      >>> array = tensor.cpu().data.numpy()
      When saving outputs of the network during training, make sure you convert ALL tensors (image, region_score,
      affinity_score) to numpy array first.
      :param image: numpy array
      :param region_scores: [] 2D numpy array with each element between 0~1.
      :param affinity_scores: same as region_scores
      :param text_threshold: 0 ~ 1. Closer to 0, characters with lower confidence will also be considered a word and be boxed
      :param link_threshold: 0 ~ 1. Closer to 0, links with lower confidence will also be considered a word and be boxed
      :param low_text: 0 ~ 1. Closer to 0, boxes will be more loosely drawn.
      :param outoput_path:
      :param confidence_mask:
      :return:
      """
  
      assert region_scores.shape == affinity_scores.shape
      assert len(image.shape) - 1 == len(region_scores.shape)
  
      boxes, polys = getDetBoxes(
          region_scores,
          affinity_scores,
          text_threshold,
          link_threshold,
          low_text,
          False,
      )
      boxes = np.array(boxes, np.int32) * 2
      if len(boxes) > 0:
          np.clip(boxes[:, :, 0], 0, image.shape[1])
          np.clip(boxes[:, :, 1], 0, image.shape[0])
          for box in boxes:
              cv2.polylines(
                  image,
                  [np.reshape(box, (-1, 1, 2))],
                  True,
                  (0, 0, 255),
              )
  
      target_gaussian_heatmap_color = imgproc.cvt2HeatmapImg(
          region_scores
      )
      target_gaussian_affinity_heatmap_color = imgproc.cvt2HeatmapImg(
          affinity_scores
      )
  
      if confidence_mask is not None:
          confidence_mask_gray = imgproc.cvt2HeatmapImg(confidence_mask)
          gt_scores = np.hstack(
              [
                  target_gaussian_heatmap_color,
                  target_gaussian_affinity_heatmap_color,
              ]
          )
          confidence_mask_gray = np.hstack(
              [
                  np.zeros_like(confidence_mask_gray),
                  confidence_mask_gray,
              ]
          )
          output = np.concatenate(
              [gt_scores, confidence_mask_gray], axis=0
          )
          output = np.hstack([image, output])
  
      else:
          gt_scores = np.concatenate(
              [
                  target_gaussian_heatmap_color,
                  target_gaussian_affinity_heatmap_color,
              ],
              axis=0,
          )
          output = np.hstack([image, gt_scores])
  
      cv2.imwrite(outoput_path, output)
      return output
  
file_path: EasyOCR/trainer/craft/utils/craft_utils.py
imports: import os
  import torch
  import cv2
  import math
  import numpy
  from data import imgproc
label_desc: Use image node_id 7 for calling a global function with example usage: save_outputs(image, region_scores, affinity_scores, text_threshold, link_threshold, low_text, outoput_path, confidence_mask) and returns: output