Exemplo n.º 1
0
def get_parser():
    parser = argparse.ArgumentParser(
        description='PyTorch Semantic Segmentation')
    parser.add_argument('--config',
                        type=str,
                        default='config/ade20k/ade20k_pspnet50.yaml',
                        help='config file')
    parser.add_argument(
        'opts',
        help='see config/ade20k/ade20k_pspnet50.yaml for all options',
        default=None,
        nargs=argparse.REMAINDER)
    args = parser.parse_args()
    assert args.config is not None
    cfg = config.load_cfg_from_cfg_file(args.config)
    if args.opts is not None:
        cfg = config.merge_cfg_from_list(cfg, args.opts)
    check(cfg)

    # backup the config file
    if os.path.exists(cfg.save_path):
        shutil.rmtree(cfg.save_path)

    os.makedirs(cfg.save_path)
    shutil.copyfile(args.config, os.path.join(cfg.save_path, "config.yaml"))
    return cfg
Exemplo n.º 2
0
def get_parser():
    parser = argparse.ArgumentParser(description='PyTorch Semantic Segmentation')
    parser.add_argument('--config', type=str, default='config/ade20k/ade20k_pspnet50.yaml', help='config file')
    parser.add_argument('opts', help='see config/ade20k/ade20k_pspnet50.yaml for all options', default=None, nargs=argparse.REMAINDER)
    args = parser.parse_args()
    assert args.config is not None
    cfg = config.load_cfg_from_cfg_file(args.config)
    if args.opts is not None:
        cfg = config.merge_cfg_from_list(cfg, args.opts)
    return cfg
Exemplo n.º 3
0
def get_parser():
    parser = argparse.ArgumentParser(description='PyTorch Semantic Segmentation')
    parser.add_argument('--config', type=str, default='config/cityscapes/cityscapes_pspnet18.yaml', help='config file')
    parser.add_argument('--image', type=str, default='figure/demo/cityscapes.jpg', help='input image')
    parser.add_argument('opts', help='see config/cityscapes/cityscapes_pspnet18.yaml for all options', default=None, nargs=argparse.REMAINDER)
    args = parser.parse_args()
    assert args.config is not None
    cfg = config.load_cfg_from_cfg_file(args.config)
    cfg.image = args.image
    if args.opts is not None:
        cfg = config.merge_cfg_from_list(cfg, args.opts)
    return cfg
Exemplo n.º 4
0
def get_parser():
    parser = argparse.ArgumentParser(
        description='PyTorch Point Cloud Classification / Semantic Segmentation'
    )
    # parser.add_argument('--config', type=str, default='config/s3dis/s3dis_pointweb.yaml', help='config file')
    parser.add_argument('--config',
                        type=str,
                        default='config/modelnet40/modelnet40_pointweb.yaml',
                        help='config file')
    parser.add_argument(
        'opts',
        help='see config/s3dis/s3dis_pointweb.yaml for all options',
        default=None,
        nargs=argparse.REMAINDER)
    args = parser.parse_args()
    assert args.config is not None
    cfg = config.load_cfg_from_cfg_file(args.config)
    if args.opts is not None:
        cfg = config.merge_cfg_from_list(cfg, args.opts)
    return cfg
Exemplo n.º 5
0
def get_parser():
    parser = argparse.ArgumentParser(
        description='PyTorch Semantic Segmentation')  # 创建 ArgumentParser() 对象
    # 添加参数:--表示可选参数,否则为定位参数
    parser.add_argument(
        '--config',
        type=str,
        default='/data/ss/URISC/CODE/FullVersion/config/URISC/urisc_unet.yaml',
        help='config file')
    parser.add_argument(
        'opts',
        help='see config/URISC/urisc_unet.yaml for all options',
        default=None,
        nargs=argparse.REMAINDER)
    # 解析添加的参数
    args = parser.parse_args()
    assert args.config is not None
    # 将yaml文件加载为CfgNode
    cfg = config.load_cfg_from_cfg_file(args.config)
    if args.opts is not None:
        cfg = config.merge_cfg_from_list(cfg, args.opts)
    return cfg