text: import argparse
  import os
  
  from cda.misc import pyutils
  
  os.environ['CUDA_VISIBLE_DEVICES'] = '6'
  if __name__ == '__main__':
  
      parser = argparse.ArgumentParser()
  
      # Environment
      parser.add_argument("--num_workers", default=os.cpu_count() // 2, type=int)
      parser.add_argument("--voc12_root", required=True, type=str,
                          help="Path to VOC 2012 Devkit, must contain ./JPEGImages as subdirectory.")
  
      # Dataset
      parser.add_argument("--train_list", default="cda/voc12/train_aug.txt", type=str)
      parser.add_argument("--val_list", default="cda/voc12/val.txt", type=str)
      parser.add_argument("--test_list", default="cda/voc12/test.txt", type=str)
      parser.add_argument("--infer_list", default="cda/voc12/train.txt", type=str,
                          help="cda/voc12/train_aug.txt to train a fully supervised model, "
                               "voc12/train.txt or voc12/val.txt to quickly check the quality of the labels.")
      parser.add_argument("--chainer_eval_set", default="train", type=str)
  
      # Class Activation Map
      parser.add_argument("--cam_network", default="cda.net.resnet50_cam", type=str)
      parser.add_argument("--cam_crop_size", default=512, type=int)
      parser.add_argument("--cam_batch_size", default=16, type=int)
      parser.add_argument("--cam_num_epoches", default=5, type=int)
      parser.add_argument("--cam_learning_rate", default=0.1, type=float)
      parser.add_argument("--cam_weight_decay", default=1e-4, type=float)
      parser.add_argument("--cam_eval_thres", default=0.15, type=float)
      parser.add_argument("--cam_scales", default=(1.0, 0.5, 1.5, 2.0),
                          help="Multi-scale inferences")
  
      # Mining Inter-pixel Relations
      parser.add_argument("--conf_fg_thres", default=0.30, type=float)
      parser.add_argument("--conf_bg_thres", default=0.05, type=float)
  
      # Inter-pixel Relation Network (IRNet)
      parser.add_argument("--irn_network", default="cda.net.resnet50_irn", type=str)
      parser.add_argument("--irn_crop_size", default=512, type=int)
      parser.add_argument("--irn_batch_size", default=32, type=int)
      parser.add_argument("--irn_num_epoches", default=3, type=int)
      parser.add_argument("--irn_learning_rate", default=0.1, type=float)
      parser.add_argument("--irn_weight_decay", default=1e-4, type=float)
  
      # Random Walk Params
      parser.add_argument("--beta", default=10)
      parser.add_argument("--exp_times", default=8,
                          help="Hyper-parameter that controls the number of random walk iterations,"
                               "The random walk is performed 2^{exp_times}.")
      parser.add_argument("--ins_seg_bg_thres", default=0.25)
      parser.add_argument("--sem_seg_bg_thres", default=0.25)
  
      # Output Path
      parser.add_argument("--log_name", default="sample_train_eval", type=str)
      parser.add_argument("--cam_weights_name", default="sess/cda/res50_cam.pth", type=str)
      parser.add_argument("--irn_weights_name", default="sess/cda/res50_irn.pth", type=str)
      parser.add_argument("--cam_out_dir", default="result/cda/cam", type=str)
      parser.add_argument("--ir_label_out_dir", default="result/cda/ir_label", type=str)
      parser.add_argument("--sem_seg_out_dir", default="result/cda/sem_seg", type=str)
      parser.add_argument("--ins_seg_out_dir", default="result/cda/ins_seg", type=str)
  
      # Step
      parser.add_argument("--train_cam_pass", default=True)
      parser.add_argument("--make_cam_pass", default=True)
      parser.add_argument("--eval_cam_pass", default=True)
      parser.add_argument("--cam_to_ir_label_pass", default=True)
      parser.add_argument("--train_irn_pass", default=True)
      parser.add_argument("--make_ins_seg_pass", default=True)
      parser.add_argument("--eval_ins_seg_pass", default=True)
      parser.add_argument("--make_sem_seg_pass", default=True)
      parser.add_argument("--eval_sem_seg_pass", default=True)
  
      #######################自定义参数######################
      parser.add_argument("--cam_weights_aug_name", default="sess/cda/res50_cam_aug.pth", type=str)
      parser.add_argument("--irn_weights_aug_name", default="sess/cda/res50_irn_aug.pth", type=str)
      parser.add_argument("--cam_out_aug_dir", default="result_aug/cda/cam_aug", type=str)
      parser.add_argument("--ir_label_out_aug_dir", default="result_aug/cda/ir_label_aug", type=str)
      parser.add_argument("--sem_seg_out_aug_dir", default="result_aug/cda/sem_seg_aug", type=str)
      parser.add_argument("--sem_seg_out_fg_dir", default="result/cda/sem_seg_fg", type=str)
      #######################自定义参数######################
      args = parser.parse_args()
  
      os.makedirs("sess", exist_ok=True)
      os.makedirs(args.cam_out_dir, exist_ok=True)
      os.makedirs(args.ir_label_out_dir, exist_ok=True)
      os.makedirs(args.sem_seg_out_dir, exist_ok=True)
  
      #######################修改代码######################
      os.makedirs(args.cam_out_aug_dir, exist_ok=True)
      os.makedirs(args.ir_label_out_aug_dir, exist_ok=True)
      os.makedirs(args.sem_seg_out_aug_dir, exist_ok=True)
      #######################修改代码######################
  
      pyutils.Logger(args.log_name + '.log')
      print(vars(args))
  
      if args.train_cam_pass is True:
          from cda.step import train_cam
  
          timer = pyutils.Timer('step.train_cam:')
          train_cam.run(args)
  
      if args.make_cam_pass is True:
          from cda.step import  make_cam
  
          timer = pyutils.Timer('step.make_cam:')
          make_cam.run(args)
  
      if args.eval_cam_pass is True:
          from cda.step import  eval_cam
  
          timer = pyutils.Timer('step.eval_cam:')
          eval_cam.run(args)
  
      # if args.cam_to_ir_label_pass is True:
      #     import step.cam_to_ir_label
  
      #     timer = pyutils.Timer('step.cam_to_ir_label:')
      #     step.cam_to_ir_label.run(args)
  
      # if args.train_irn_pass is True:
      #     import step.train_irn
  
      #     timer = pyutils.Timer('step.train_irn:')
      #     step.train_irn.run(args)
  
      # if args.make_sem_seg_pass is True:
      #     import step.make_sem_seg_labels
  
      #     timer = pyutils.Timer('step.make_sem_seg_labels:')
      #     step.make_sem_seg_labels.run(args)
  
      # if args.eval_sem_seg_pass is True:
      #     import step.eval_sem_seg
  
      #     timer = pyutils.Timer('step.eval_sem_seg:')
      #     step.eval_sem_seg.run(args)
  
      # ###########增强部分############
      # import step.make_aug_fg
      # step.make_aug_fg.run(args)
  
      # import aug_step.train_cam
      # aug_step.train_cam.run(args)
  
      # import aug_step.make_cam
      # aug_step.make_cam.run(args)
  
      # import aug_step.eval_cam
      # aug_step.eval_cam.run(args)
  
      # import aug_step.cam_to_ir_label
      # aug_step.cam_to_ir_label.run(args)
  
      # import aug_step.train_irn
      # aug_step.train_irn.run(args)
  
      # import aug_step.make_sem_seg_labels
      # aug_step.make_sem_seg_labels.run(args)
  
      # import aug_step.eval_sem_seg
      # aug_step.eval_sem_seg.run(args)
  