()
return args
Parse all the arguments
    Returns: args
    A list of parsed arguments.
Parse all the arguments
    Returns: args
    A list of parsed arguments.
Parse all the arguments Returns : args A list of parsed arguments .
def get_arguments():
    """
    Parse all the arguments
    Returns: args
    A list of parsed arguments.
    """
    parser = argparse.ArgumentParser(description="DeepLab-ResNet Network")
    parser.add_argument("--batch_size_per_gpu", type=int, default=1,
                        help="Number of images sent to the network in one step.")
    parser.add_argument("--batch_size", type=int, default=8,
                        help="Number of images sent to the network in one step.")
    parser.add_argument('--gpu_num', type=int, default=8)
    parser.add_argument("--data_dir", type=str, default="./data",
                        help="Path to the directory containing the Cityscapes dataset.")
    parser.add_argument("--data_list", type=str, default="./data/cityscapes/train.txt",
                        help="Path to the file listing the images in the dataset.")
    parser.add_argument("--data_set", type=str, default="cityscapes", help="dataset to train")
    parser.add_argument("--arch", type=str, default="", help="network architecture")
    parser.add_argument("--ignore_label", type=int, default=255,
                        help="The index of the label to ignore during the training.")
    parser.add_argument("--input_size", type=int, default=832 ,
                        help="Comma-separated string with height and width of images.")
    parser.add_argument("--learning_rate", type=float, default=1e-2,
                        help="Base learning rate for training with polynomial decay.")
    parser.add_argument("--momentum", type=float, default=0.9,
                        help="Momentum component of the optimiser.")
    parser.add_argument("--num_classes", type=int, default=19,
                        help="Number of classes to predict (including background).")
    parser.add_argument("--num_steps", type=int, default=50000,
                        help="Number of training steps.")
    parser.add_argument("--power", type=float, default=0.9,
                        help="Decay parameter to compute the learning rate.")
    parser.add_argument("--weight_decay", type=float, default=5e-4,
                        help="Regularisation parameter for L2-loss.")
    parser.add_argument("--num_workers", type=int, default=8)
    parser.add_argument("--random_mirror", action="store_true", default=True,
                        help="Whether to randomly mirror the inputs during the training.")
    parser.add_argument("--random_scale", action="store_true", default=True,
                        help="Whether to randomly scale the inputs during the training.")
    parser.add_argument("--random_seed", type=int, default=1234,
                        help="Random seed to have reproducible results.")

    # ***** Params for save and load ******
    parser.add_argument("--restore_from", type=str, default="./pretrained",
                        help="Where restore models parameters from.")
    parser.add_argument("--save_pred_every", type=int, default=5000,
                        help="Save summaries and checkpoint every often.")
    parser.add_argument("--save_dir", type=str, default=None,
                        help="Where to save snapshots of the models.")
    parser.add_argument("--save_start",type=int, default=40000)
    parser.add_argument("--gpu", type=str, default=None,
                        help="choose gpu device.")
    parser.add_argument("--ft", type=bool, default=False,
                        help="fine-tune the models with large input size.")
    # **** Params for OHEM **** #
    parser.add_argument("--ohem", type=str2bool, default='False',
                        help="use hard negative mining")
    parser.add_argument("--ohem_thres", type=float, default=0.7,
                        help="choose the samples with correct probability underthe threshold.")
    parser.add_argument("--ohem_keep", type=int, default=100000,
                        help="choose the samples with correct probability underthe threshold.")
    # ***** Params for logging ***** #
    parser.add_argument('--log_level', default="info", type=str,
                        dest='log_level', help='To set the log level to files.')
    parser.add_argument('--log_file', default="./log/train.log", type=str,
                        dest='log_file', help='The path of log files.')
    parser.add_argument("--log_format", default="%(asctime)s %(levelname)-7s %(message)s", type=str,
                        dest="log_format", help="format of log files"
                        )
    parser.add_argument('--stdout_level', default="info", type=str,
                        dest='stdout_level', help='To set the level to print to screen.')
    parser.add_argument("--rewrite", default=False, type=bool,
                        dest="rewrite", help="whether write the file when using log"
                        )
    parser.add_argument("--rgb", type=str2bool, default='False')
    # ***** Params for Distributed Traning ***** #
    parser.add_argument('--apex', action='store_true', default=False,
                        help='Use Nvidia Apex Distributed Data Parallel')
    parser.add_argument("--local_rank", default=0, type=int, help="parameter used by apex library")
    args = parser.parse_args()
    return args
def get_arguments ( ) : parser = argparse . ArgumentParser ( description = "DeepLab-ResNet Network" ) parser . add_argument ( "--batch_size_per_gpu" , type = int , default = 1 , help = "Number of images sent to the network in one step." ) parser . add_argument ( "--batch_size" , type = int , default = 8 , help = "Number of images sent to the network in one step." ) parser . add_argument ( '--gpu_num' , type = int , default = 8 ) parser . add_argument ( "--data_dir" , type = str , default = "./data" , help = "Path to the directory containing the Cityscapes dataset." ) parser . add_argument ( "--data_list" , type = str , default = "./data/cityscapes/train.txt" , help = "Path to the file listing the images in the dataset." ) parser . add_argument ( "--data_set" , type = str , default = "cityscapes" , help = "dataset to train" ) parser . add_argument ( "--arch" , type = str , default = "" , help = "network architecture" ) parser . add_argument ( "--ignore_label" , type = int , default = 255 , help = "The index of the label to ignore during the training." ) parser . add_argument ( "--input_size" , type = int , default = 832 , help = "Comma-separated string with height and width of images." ) parser . add_argument ( "--learning_rate" , type = float , default = 1e-2 , help = "Base learning rate for training with polynomial decay." ) parser . add_argument ( "--momentum" , type = float , default = 0.9 , help = "Momentum component of the optimiser." ) parser . add_argument ( "--num_classes" , type = int , default = 19 , help = "Number of classes to predict (including background)." ) parser . add_argument ( "--num_steps" , type = int , default = 50000 , help = "Number of training steps." ) parser . add_argument ( "--power" , type = float , default = 0.9 , help = "Decay parameter to compute the learning rate." ) parser . add_argument ( "--weight_decay" , type = float , default = 5e-4 , help = "Regularisation parameter for L2-loss." ) parser . add_argument ( "--num_workers" , type = int , default = 8 ) parser . add_argument ( "--random_mirror" , action = "store_true" , default = True , help = "Whether to randomly mirror the inputs during the training." ) parser . add_argument ( "--random_scale" , action = "store_true" , default = True , help = "Whether to randomly scale the inputs during the training." ) parser . add_argument ( "--random_seed" , type = int , default = 1234 , help = "Random seed to have reproducible results." ) # ***** Params for save and load ****** parser . add_argument ( "--restore_from" , type = str , default = "./pretrained" , help = "Where restore models parameters from." ) parser . add_argument ( "--save_pred_every" , type = int , default = 5000 , help = "Save summaries and checkpoint every often." ) parser . add_argument ( "--save_dir" , type = str , default = None , help = "Where to save snapshots of the models." ) parser . add_argument ( "--save_start" , type = int , default = 40000 ) parser . add_argument ( "--gpu" , type = str , default = None , help = "choose gpu device." ) parser . add_argument ( "--ft" , type = bool , default = False , help = "fine-tune the models with large input size." ) # **** Params for OHEM **** # parser . add_argument ( "--ohem" , type = str2bool , default = 'False' , help = "use hard negative mining" ) parser . add_argument ( "--ohem_thres" , type = float , default = 0.7 , help = "choose the samples with correct probability underthe threshold." ) parser . add_argument ( "--ohem_keep" , type = int , default = 100000 , help = "choose the samples with correct probability underthe threshold." ) # ***** Params for logging ***** # parser . add_argument ( '--log_level' , default = "info" , type = str , dest = 'log_level' , help = 'To set the log level to files.' ) parser . add_argument ( '--log_file' , default = "./log/train.log" , type = str , dest = 'log_file' , help = 'The path of log files.' ) parser . add_argument ( "--log_format" , default = "%(asctime)s %(levelname)-7s %(message)s" , type = str , dest = "log_format" , help = "format of log files" ) parser . add_argument ( '--stdout_level' , default = "info" , type = str , dest = 'stdout_level' , help = 'To set the level to print to screen.' ) parser . add_argument ( "--rewrite" , default = False , type = bool , dest = "rewrite" , help = "whether write the file when using log" ) parser . add_argument ( "--rgb" , type = str2bool , default = 'False' ) # ***** Params for Distributed Traning ***** # parser . add_argument ( '--apex' , action = 'store_true' , default = False , help = 'Use Nvidia Apex Distributed Data Parallel' ) parser . add_argument ( "--local_rank" , default = 0 , type = int , help = "parameter used by apex library" ) args = parser . parse_args ( ) return args