当前位置: 首页>>代码示例>>Python>>正文


Python cfg.freeze方法代码示例

本文整理汇总了Python中maskrcnn_benchmark.config.cfg.freeze方法的典型用法代码示例。如果您正苦于以下问题:Python cfg.freeze方法的具体用法?Python cfg.freeze怎么用?Python cfg.freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maskrcnn_benchmark.config.cfg的用法示例。


在下文中一共展示了cfg.freeze方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser=argparse.ArgumentParser()
    parser.add_argument('-r','--refresh',action='store_true')
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    args=parser.parse_args()
    refresh=args.refresh

    t = time.time()

    cfg.merge_from_file(args.config_file)
    cfg.OUTPUT_DIR = config.log_dir
    cfg.freeze()
    trainer=EvolutionTrainer(cfg,refresh=refresh)

    trainer.train()
    print('total searching time = {:.2f} hours'.format((time.time()-t)/3600)) 
开发者ID:megvii-model,项目名称:DetNAS,代码行数:24,代码来源:search.py

示例2: __init__

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def __init__(
        self,
        region_type,
        ground_level, 
        ground_removal_th,
        use_maskrcnn,
        city_name,
        min_point_num,
        dbscan_eps,
        calib_data,
        path_debug_output,
        ground_removal_method,
        dataset_name,
        path_rcnn_config="../mask_rcnn/models/e2e_mask_rcnn_R_50_FPN_1x.yaml",

    ):
        self.region_type = region_type
        self.ground_level = ground_level
        self.ground_removal_th = ground_removal_th
        self.use_maskrcnn = use_maskrcnn
        self.city_name = city_name
        self.min_point_num = min_point_num
        self.dbscan_eps = dbscan_eps
        self.calib_data = calib_data
        self.path_debug_output = path_debug_output
        self.ground_removal_method = ground_removal_method
        self.dataset_name = dataset_name

        if use_maskrcnn:
            cfg.merge_from_file(path_rcnn_config)
            cfg.freeze()

            # using setting in official demo
            coco_demo_detector = COCODemo(
                cfg,
                confidence_threshold=0.7,
                min_image_size=224,
            )

            self.mask_rcnn_detector = coco_demo_detector 
开发者ID:alliecc,项目名称:argoverse_baselinetracker,代码行数:42,代码来源:tracker.py

示例3: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.init_process_group(
            backend="nccl", init_method="env://"
        )
        synchronize()

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        run_test(cfg, model, args.distributed) 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:62,代码来源:train_net.py

示例4: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="../configs/e2e_r2cnn_R_50_FPN_1x.yaml",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        default=True,
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.init_process_group(
            backend="nccl", init_method="env://"
        )
        synchronize()

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        run_test(cfg, model, args.distributed) 
开发者ID:Xiangyu-CAS,项目名称:R2CNN.pytorch,代码行数:63,代码来源:train_net.py

示例5: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser=argparse.ArgumentParser()
    # parser.add_argument('-b', '--batch-size', type=int, default=128)
    parser.add_argument('-p', '--process', type=int, default=1)
    parser.add_argument('-r', '--reset', action='store_true')
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )
    parser.add_argument("--master_addr", default="127.0.0.1", type=str,
                        help="Master node (rank 0)'s address, should be either "
                             "the IP address or the hostname of node 0, for "
                             "single node multi-proc training, the "
                             "--master_addr can simply be 127.0.0.1")

    parser.add_argument("--master_port", default=29500, type=int,
                        help="Master node (rank 0)'s free port that needs to "
                             "be used for communciation during distributed "
                             "training")
    args=parser.parse_args()

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)

    ngpus_per_node = torch.cuda.device_count()
    os.environ["WORLD_SIZE"] = str(ngpus_per_node)
    os.environ["MASTER_ADDR"] = args.master_addr
    os.environ["MASTER_PORT"] = str(args.master_port)

    cfg.SOLVER.IMS_PER_BATCH = 8
    cfg.SOLVER.MAX_ITER = 88888888
    cfg.TEST.IMS_PER_BATCH = ngpus_per_node
    cfg.OUTPUT_DIR = config.log_dir
    cfg.freeze()

    train_server = TestServer(ngpus_per_node)
    train_server.run(args.process, reset_pipe=args.reset) 
开发者ID:megvii-model,项目名称:DetNAS,代码行数:48,代码来源:test_server.py

示例6: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="../configs/rrpn/e2e_rrpn_X_101_32x8d_FPN_1x_DOTA.yaml",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.init_process_group(
            backend="nccl", init_method="env://"
        )
        synchronize()

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        test(cfg, model, args.distributed) 
开发者ID:clw5180,项目名称:remote_sensing_object_detection_2019,代码行数:62,代码来源:train_net.py

示例7: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Inference")
    parser.add_argument(
        "--config-file",
        default="/private/home/fmassa/github/detectron.pytorch_v2/configs/e2e_faster_rcnn_R_50_C4_1x_caffe2.yaml",
        metavar="FILE",
        help="path to config file",
    )

    parser.add_argument(
        "--checkpoint", default="", metavar="FILE", help="path to checkpoint file"
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    distributed = (
        int(os.environ["WORLD_SIZE"]) > 1 if "WORLD_SIZE" in os.environ else False
    )

    if distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.init_process_group(backend="nccl", init_method="env://")

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    save_dir = ""
    logger = setup_logger("maskrcnn_benchmark", save_dir, args.local_rank)
    logger.info(cfg)

    model = build_detection_model(cfg)
    model.to(cfg.MODEL.DEVICE)

    load_from_checkpoint(cfg, model, args.checkpoint)

    data_loader_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)

    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    inference(model, data_loader_val, iou_types=iou_types, box_only=cfg.MODEL.RPN_ONLY, device=cfg.MODEL.DEVICE) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:51,代码来源:test_net.py

示例8: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="configs/free_anchor_R-50-FPN_8gpu_1x.yaml",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank % torch.cuda.device_count())
        torch.distributed.init_process_group(
            backend="nccl", init_method="env://"
        )

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        test(cfg, model, args.distributed) 
开发者ID:zhangxiaosong18,项目名称:FreeAnchor,代码行数:61,代码来源:train_net.py

示例9: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.deprecated.init_process_group(
            backend="nccl", init_method="env://"
        )

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        test(cfg, model, args.distributed) 
开发者ID:chengyangfu,项目名称:retinamask,代码行数:61,代码来源:train_net.py

示例10: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--local_rank", type=int, default=0)
    parser.add_argument(
        "--skip-test",
        dest="skip_test",
        help="Do not test the final model",
        action="store_true",
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )

    args = parser.parse_args()

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
    args.distributed = num_gpus > 1

    if args.distributed:
        torch.cuda.set_device(args.local_rank)
        torch.distributed.init_process_group(
            backend="nccl", init_method="env://"
        )
        synchronize()

    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    if output_dir:
        mkdir(output_dir)

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())
    logger.info("Using {} GPUs".format(num_gpus))
    logger.info(args)

    logger.info("Collecting env info (might take some time)")
    logger.info("\n" + collect_env_info())

    logger.info("Loaded configuration file {}".format(args.config_file))
    with open(args.config_file, "r") as cf:
        config_str = "\n" + cf.read()
        logger.info(config_str)
    logger.info("Running with config:\n{}".format(cfg))

    model = train(cfg, args.local_rank, args.distributed)

    if not args.skip_test:
        test(cfg, model, args.distributed) 
开发者ID:mlperf,项目名称:training,代码行数:62,代码来源:train_net.py

示例11: main

# 需要导入模块: from maskrcnn_benchmark.config import cfg [as 别名]
# 或者: from maskrcnn_benchmark.config.cfg import freeze [as 别名]
def main():  
    parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")  
    parser.add_argument(  
        "--config-file",  
        default="",  
        metavar="FILE",  
        help="path to config file",  
        type=str,  
    )  
    parser.add_argument("--local_rank", type=int, default=0)  
    parser.add_argument(  
        "--skip-test",  
        dest="skip_test",  
        help="Do not test the final model",  
        action="store_true",  
    )  
    parser.add_argument(  
        "opts",  
        help="Modify config options using the command-line",  
        default=None,  
        nargs=argparse.REMAINDER,  
    )  

    args = parser.parse_args()  

    num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1  
    args.distributed = num_gpus > 1  

    if args.distributed:  
        torch.cuda.set_device(args.local_rank)  
        torch.distributed.init_process_group(  
            backend="nccl", init_method="env://"  
        )  
        synchronize()  

    cfg.merge_from_file(args.config_file)  
    cfg.merge_from_list(args.opts)  
    cfg.freeze()  

    output_dir = cfg.OUTPUT_DIR  
    if output_dir:  
        mkdir(output_dir)  

    logger = setup_logger("maskrcnn_benchmark", output_dir, get_rank())  
    logger.info("Using {} GPUs".format(num_gpus))  
    logger.info(args)  

    logger.info("Collecting env info (might take some time)")  
    logger.info("\n" + collect_env_info())  

    logger.info("Loaded configuration file {}".format(args.config_file))  
    with open(args.config_file, "r") as cf:  
        config_str = "\n" + cf.read()  
        logger.info(config_str)  
    logger.info("Running with config:\n{}".format(cfg))  

    logger.info("Arch Decoder: {}".format(cfg.SEARCH.DECODER.CONFIG))  
    model = train(cfg, args.local_rank, args.distributed)  

    if not args.skip_test:  
        run_test(cfg, model, args.distributed) 
开发者ID:Lausannen,项目名称:NAS-FCOS,代码行数:63,代码来源:train_net.py


注:本文中的maskrcnn_benchmark.config.cfg.freeze方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。