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


Python mmcv.ProgressBar方法代码示例

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


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

示例1: single_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_gpu_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)

        if show:
            model.module.show_result(data, result, dataset.img_norm_cfg)

        # encode mask results
        if isinstance(result, tuple):
            bbox_results, mask_results = result
            encoded_mask_results = encode_mask_results(mask_results)
            result = bbox_results, encoded_mask_results
        results.append(result)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:25,代码来源:test_robustness.py

示例2: main

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def main():
    args = parse_args()
    cfg = retrieve_data_cfg(args.config, args.skip_type)

    dataset = build_dataset(cfg.data.train)

    progress_bar = mmcv.ProgressBar(len(dataset))
    for item in dataset:
        filename = os.path.join(args.output_dir,
                                Path(item['filename']).name
                                ) if args.output_dir is not None else None
        mmcv.imshow_det_bboxes(
            item['img'],
            item['gt_bboxes'],
            item['gt_labels'] - 1,
            class_names=dataset.CLASSES,
            show=not args.not_show,
            out_file=filename,
            wait_time=args.show_interval)
        progress_bar.update() 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:22,代码来源:browse_dataset.py

示例3: single_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_gpu_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result, dataset.img_norm_cfg)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:19,代码来源:test_robustness.py

示例4: multi_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def multi_gpu_test(model, data_loader, tmpdir=None):
    model.eval()
    results = []
    dataset = data_loader.dataset
    rank, world_size = get_dist_info()
    if rank == 0:
        prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=True, **data)
        results.append(result)

        if rank == 0:
            batch_size = data['img'][0].size(0)
            for _ in range(batch_size * world_size):
                prog_bar.update()

    # collect results from all ranks
    results = collect_results(results, len(dataset), tmpdir)

    return results 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:23,代码来源:test_robustness.py

示例5: single_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_gpu_test(model, data_loader, show=False, log_dir=None):
    model.eval()
    results = []
    dataset = data_loader.dataset
    if log_dir != None:
        filename = 'inference{}.log'.format(get_time_str())
        log_file = osp.join(log_dir, filename)
        f = open(log_file, 'w')
        prog_bar = mmcv.ProgressBar(len(dataset), file=f)
    else:
        prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result, dataset.img_norm_cfg)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()

    return results 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:26,代码来源:test.py

示例6: single_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_gpu_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results 
开发者ID:tascj,项目名称:kaggle-kuzushiji-recognition,代码行数:19,代码来源:test.py

示例7: single_gpu_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_gpu_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result, score_thr=0.3)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results 
开发者ID:wangsr126,项目名称:RDSNet,代码行数:19,代码来源:test.py

示例8: single_test

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import ProgressBar [as 别名]
def single_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result, dataset.img_norm_cfg,
                                     dataset='vg', score_thr=0.4, save_num='work_dirs/fpn_hkrm/0.3_vghkrm_%08d'%i + '.jpg')
                                     # dataset=dataset.CLASSES)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results 
开发者ID:chanyn,项目名称:Reasoning-RCNN,代码行数:21,代码来源:test.py


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