code: def save_result_2013(
      img_file, img, pre_output, pre_box, gt_box=None, result_dir=""
  ):
      img = np.array(img)
      img_copy = img.copy()
      region = pre_output[0]
      affinity = pre_output[1]
  
      # make result file list
      filename, file_ext = os.path.splitext(os.path.basename(img_file))
  
      # draw bounding boxes for prediction, color green
      for i, box in enumerate(pre_box):
          poly = np.array(box).astype(np.int32).reshape((-1))
          poly = poly.reshape(-1, 2)
          try:
              cv2.polylines(
                  img,
                  [poly.reshape((-1, 1, 2))],
                  True,
                  color=(0, 255, 0),
                  thickness=2,
              )
          except:
              pass
  
      # draw bounding boxes for gt, color red
      if gt_box is not None:
          for j in range(len(gt_box)):
              cv2.polylines(
                  img,
                  [np.array(gt_box[j]["points"]).reshape((-1, 1, 2))],
                  True,
                  color=(0, 0, 255),
                  thickness=2,
              )
  
      # draw overlay image
      overlay_img = overlay(img_copy, region, affinity, pre_box)
  
      # Save result image
      res_img_path = result_dir + "/res_" + filename + ".jpg"
      cv2.imwrite(res_img_path, img)
  
      overlay_image_path = result_dir + "/res_" + filename + "_box.jpg"
      cv2.imwrite(overlay_image_path, overlay_img)
  
imports: import argparse
  import os
  import cv2
  import numpy
  import torch
  import torch.backends.cudnn
  from tqdm import tqdm
  import wandb
  from config.load_config import load_yaml, DotDict
  from model.craft import CRAFT
  from metrics.eval_det_iou import DetectionIoUEvaluator
  from utils.inference_boxes import test_net, load_icdar2015_gt, load_icdar2013_gt, load_synthtext_gt
  from utils.util import copyStateDict
label_desc: Use image node_id 3 for calling a global function with example usage: save_result_2013(img_file, img, pre_output, pre_box, gt_box, result_dir) without return types