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


Python inference.inference方法代码示例

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


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

示例1: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    data_loader_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    results = inference(
        model,
        data_loader_val,
        iou_types=iou_types,
        box_only=cfg.MODEL.RPN_ONLY,
        device=cfg.MODEL.DEVICE,
        expected_results=cfg.TEST.EXPECTED_RESULTS,
        expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
    )

    # returning results
    return results 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:22,代码来源:tester.py

示例2: run_test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def run_test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=False if cfg.MODEL.RETINANET_ON else cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:Res2Net,项目名称:Res2Net-maskrcnn,代码行数:32,代码来源:train_net.py

示例3: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:clw5180,项目名称:remote_sensing_object_detection_2019,代码行数:30,代码来源:train_net.py

示例4: run_test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def run_test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=False if cfg.MODEL.RETINANET_ON else cfg.MODEL.RPN_ONLY,
            bbox_aug=cfg.TEST.BBOX_AUG.ENABLED,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:facebookresearch,项目名称:maskrcnn-benchmark,代码行数:33,代码来源:train_net.py

示例5: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    if cfg.OUTPUT_DIR:
        dataset_names = cfg.DATASETS.TEST
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, data_loader_val in zip(output_folders, data_loaders_val):
        inference(
            model,
            data_loader_val,
            iou_types=iou_types,
            #box_only=cfg.MODEL.RPN_ONLY,
            box_only=False if cfg.RETINANET.RETINANET_ON else cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:zhangxiaosong18,项目名称:FreeAnchor,代码行数:30,代码来源:train_net.py

示例6: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    results = []
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        result = inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize()
        results.append(result)
    return results 
开发者ID:mlperf,项目名称:training,代码行数:33,代码来源:tester.py

示例7: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=False if cfg.MODEL.RETINANET_ON else cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:mlperf,项目名称:training,代码行数:32,代码来源:train_net.py

示例8: run_test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def run_test(cfg, model, distributed):  
    if distributed:  
        model = model.module  
    torch.cuda.empty_cache()  # TODO check if it helps  
    iou_types = ("bbox",)  
    if cfg.MODEL.MASK_ON:  
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)  
    output_folders = [None] * len(cfg.DATASETS.TEST)  
    dataset_names = cfg.DATASETS.TEST  
    if cfg.OUTPUT_DIR:  
        for idx, dataset_name in enumerate(dataset_names):  
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)  
            mkdir(output_folder)  
            output_folders[idx] = output_folder  
    data_loaders_val = make_data_loader(cfg, mode=0, resolution=None, is_train=False, is_distributed=distributed)
    for loader in data_loaders_val:
        loader.collate_fn.special_deal = False
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):  
        inference(  
            model,  
            data_loader_val,  
            dataset_name=dataset_name,  
            iou_types=iou_types,  
            box_only=False if (cfg.MODEL.RETINANET_ON or cfg.MODEL.DENSEBOX_ON) else cfg.MODEL.RPN_ONLY,  
            device=cfg.MODEL.DEVICE,  
            expected_results=cfg.TEST.EXPECTED_RESULTS,  
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,  
            output_folder=output_folder,  
        )  
        synchronize() 
开发者ID:Lausannen,项目名称:NAS-FCOS,代码行数:34,代码来源:train_net.py

示例9: test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    if cfg.OUTPUT_DIR:
        dataset_names = cfg.DATASETS.TEST
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, data_loader_val in zip(output_folders, data_loaders_val):
        inference(
            model,
            data_loader_val,
            iou_types=iou_types,
            box_only=cfg.MODEL.RPN_ONLY,
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
            maskiou_on=cfg.MODEL.MASKIOU_ON
        )
        synchronize() 
开发者ID:zjhuang22,项目名称:maskscoring_rcnn,代码行数:30,代码来源:train_net.py

示例10: run_test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def run_test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=False if cfg.MODEL.FCOS_ON or cfg.MODEL.RETINANET_ON or cfg.MODEL.GAU_ON else cfg.MODEL.RPN_ONLY,  # changed for fcos
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
            ignore_uncertain=cfg.TEST.IGNORE_UNCERTAIN,
            use_iod_for_ignore=cfg.TEST.USE_IOD_FOR_IGNORE,
            eval_standard=cfg.TEST.COCO_EVALUATE_STANDARD,
            use_last_prediction=cfg.TEST.DEBUG.USE_LAST_PREDICTION,
            evaluate_method=cfg.TEST.EVALUATE_METHOD,
            voc_iou_ths=cfg.TEST.VOC_IOU_THS,
            gt_file={'merge': cfg.TEST.MERGE_GT_FILE,
                     'sub': DatasetCatalog.DATA_DIR + '/' + DatasetCatalog.DATASETS[dataset_name]["ann_file"]},
            use_ignore_attr=cfg.TEST.USE_IGNORE_ATTR
        )
        synchronize()

# ################################################ add by hui ################################################# 
开发者ID:ucas-vg,项目名称:TinyBenchmark,代码行数:43,代码来源:train_test_net.py

示例11: run_test

# 需要导入模块: from maskrcnn_benchmark.engine import inference [as 别名]
# 或者: from maskrcnn_benchmark.engine.inference import inference [as 别名]
def run_test(cfg, model, distributed):
    if distributed:
        model = model.module
    torch.cuda.empty_cache()  # TODO check if it helps
    iou_types = ("bbox",)
    if cfg.MODEL.MASK_ON:
        iou_types = iou_types + ("segm",)
    if cfg.MODEL.KEYPOINT_ON:
        iou_types = iou_types + ("keypoints",)
    output_folders = [None] * len(cfg.DATASETS.TEST)
    dataset_names = cfg.DATASETS.TEST
    if cfg.OUTPUT_DIR:
        for idx, dataset_name in enumerate(dataset_names):
            output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
            mkdir(output_folder)
            output_folders[idx] = output_folder
    data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
    for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
        inference(
            model,
            data_loader_val,
            dataset_name=dataset_name,
            iou_types=iou_types,
            box_only=False if cfg.MODEL.FCOS_ON or cfg.MODEL.RETINANET_ON else cfg.MODEL.RPN_ONLY,  # changed for fcos
            device=cfg.MODEL.DEVICE,
            expected_results=cfg.TEST.EXPECTED_RESULTS,
            expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
            output_folder=output_folder,
        )
        synchronize() 
开发者ID:ucas-vg,项目名称:TinyBenchmark,代码行数:32,代码来源:train_net.py


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