code: def main():
      parser = argparse.ArgumentParser(
          description="CRAFT SynthText Train"
      )
      parser.add_argument(
          "--yaml",
          "--yaml_file_name",
          default="syn_train",
          type=str,
          help="Load configuration",
      )
      parser.add_argument(
          "--port",
          "--use ddp port",
          default="2646",
          type=str,
          help="Load configuration",
      )
  
      args = parser.parse_args()
  
      # load configure
      exp_name = args.yaml
      config = load_yaml(args.yaml)
  
      print("-" * 20 + " Options " + "-" * 20)
      print(yaml.dump(config))
      print("-" * 40)
  
      # Make result_dir
      res_dir = os.path.join(config["results_dir"], args.yaml)
      config["results_dir"] = res_dir
      if not os.path.exists(res_dir):
          os.makedirs(res_dir)
  
      # Duplicate yaml file to result_dir
      shutil.copy(
          "config/" + args.yaml + ".yaml",
          os.path.join(res_dir, args.yaml) + ".yaml",
      )
  
      ngpus_per_node = torch.cuda.device_count()
      print(f"Total device num : {ngpus_per_node}")
  
      manager = mp.Manager()
      buffer1 = manager.list(
          [None] * config["test"]["icdar2013"]["test_set_size"]
      )
      buffer_dict = {"icdar2013": buffer1}
      torch.multiprocessing.spawn(
          main_worker,
          nprocs=ngpus_per_node,
          args=(
              args.port,
              ngpus_per_node,
              config,
              buffer_dict,
              exp_name,
          ),
      )
      print("flag5")
  
imports: import argparse
  import os
  import shutil
  import time
  import yaml
  import multiprocessing
  import numpy
  import torch
  import torch.nn
  import torch.optim
  import wandb
  from config.load_config import load_yaml, DotDict
  from data.dataset import SynthTextDataSet
  from loss.mseloss import Maploss_v2, Maploss_v3
  from model.craft import CRAFT
  from metrics.eval_det_iou import DetectionIoUEvaluator
  from eval import main_eval
  from utils.util import copyStateDict, save_parser
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types