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


Python json_dataset.JsonDataset方法代码示例

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


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

示例1: get_roidb_and_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb_and_dataset(dataset_name, proposal_file, ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(dataset_name)
    if cfg.TEST.PRECOMPUTED_PROPOSALS:
        assert proposal_file, 'No proposal file given'
        roidb = dataset.get_roidb(
            proposal_file=proposal_file,
            proposal_limit=cfg.TEST.PROPOSAL_LIMIT
        )
    else:
        roidb = dataset.get_roidb()

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, dataset, start, end, total_num_images 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:26,代码来源:test_engine.py

示例2: get_roidb

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb(dataset_name, ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(dataset_name)
    roidb = dataset.get_roidb(gt=cfg.TEST.USE_GT_PROPOSALS)

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, start, end, total_num_images 
开发者ID:ruotianluo,项目名称:Context-aware-ZSR,代码行数:19,代码来源:rpn_generator.py

示例3: get_roidb

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb(dataset_name, ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(dataset_name)
    roidb = dataset.get_roidb()

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, start, end, total_num_images 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:19,代码来源:rpn_generator.py

示例4: get_roidb_and_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb_and_dataset(dataset_name, proposal_file, ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(dataset_name)
    if cfg.TEST.PRECOMPUTED_PROPOSALS:
        assert proposal_file, 'No proposal file given'
        roidb = dataset.get_roidb(
            proposal_file=proposal_file,
            proposal_limit=cfg.TEST.PROPOSAL_LIMIT
        )
    else:
        roidb = dataset.get_roidb(gt=cfg.DEBUG_TEST_WITH_GT)

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, dataset, start, end, total_num_images 
开发者ID:bobwan1995,项目名称:PMFNet,代码行数:26,代码来源:test_engine.py

示例5: generate_rpn_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def generate_rpn_on_dataset(multi_gpu=False):
    """Run inference on a dataset."""
    output_dir = get_output_dir(training=False)
    dataset = JsonDataset(cfg.TEST.DATASET)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        _boxes, _scores, _ids, rpn_file = multi_gpu_generate_rpn_on_dataset(
            num_images, output_dir
        )
    else:
        # Processes entire dataset range by default
        _boxes, _scores, _ids, rpn_file = generate_rpn_on_range()
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(test_timer.average_time))
    return evaluate_proposal_file(dataset, rpn_file, output_dir) 
开发者ID:lvpengyuan,项目名称:masktextspotter.caffe2,代码行数:19,代码来源:rpn_generator.py

示例6: get_roidb

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb(ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(cfg.TEST.DATASET)
    roidb = dataset.get_roidb()

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, start, end, total_num_images 
开发者ID:lvpengyuan,项目名称:masktextspotter.caffe2,代码行数:19,代码来源:rpn_generator.py

示例7: load_all_roidb

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def load_all_roidb():
    roidb = []

    ds = ('nuclei_stage_1_local_train_split',
          'nuclei_stage_1_local_val_split',
          # 'nuclei_stage_1_test',
          'nucleisegmentationbenchmark',
          'cluster_nuclei',
          'BBBC006',
          'BBBC007',
          'BBBC018',
          'BBBC020',
          '2009_ISBI_2DNuclei',
          # 'nuclei_partial_annotations',
          'TNBC_NucleiSegmentation',
          )

    for d in ds:
        roidb.extend(JsonDataset(d).get_roidb(gt=True))

    return roidb 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:23,代码来源:test_augmentations.py

示例8: test_net_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def test_net_on_dataset(output_dir, multi_gpu=False, gpu_id=0):
    """Run inference on a dataset."""
    dataset = JsonDataset(cfg.TEST.DATASET)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        all_boxes, all_segms, all_keyps = multi_gpu_test_net_on_dataset(
            num_images, output_dir
        )
    else:
        all_boxes, all_segms, all_keyps = test_net(output_dir, gpu_id=gpu_id)
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(test_timer.average_time))
    results = task_evaluation.evaluate_all(
        dataset, all_boxes, all_segms, all_keyps, output_dir
    )
    return results 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:20,代码来源:test_engine.py

示例9: get_roidb_and_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def get_roidb_and_dataset(ind_range):
    """Get the roidb for the dataset specified in the global cfg. Optionally
    restrict it to a range of indices if ind_range is a pair of integers.
    """
    dataset = JsonDataset(cfg.TEST.DATASET)
    if cfg.TEST.PRECOMPUTED_PROPOSALS:
        roidb = dataset.get_roidb(
            proposal_file=cfg.TEST.PROPOSAL_FILE,
            proposal_limit=cfg.TEST.PROPOSAL_LIMIT
        )
    else:
        roidb = dataset.get_roidb()

    if ind_range is not None:
        total_num_images = len(roidb)
        start, end = ind_range
        roidb = roidb[start:end]
    else:
        start = 0
        end = len(roidb)
        total_num_images = end

    return roidb, dataset, start, end, total_num_images 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:25,代码来源:test_engine.py

示例10: generate_rpn_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def generate_rpn_on_dataset(output_dir, multi_gpu=False, gpu_id=0):
    """Run inference on a dataset."""
    dataset = JsonDataset(cfg.TEST.DATASET)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        _boxes, _scores, _ids, rpn_file = multi_gpu_generate_rpn_on_dataset(
            num_images, output_dir
        )
    else:
        # Processes entire dataset range by default
        _boxes, _scores, _ids, rpn_file = generate_rpn_on_range(
            output_dir, gpu_id=gpu_id
        )
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(test_timer.average_time))
    return evaluate_proposal_file(dataset, rpn_file, output_dir) 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:20,代码来源:rpn_generator.py

示例11: do_reval

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def do_reval(dataset_name, output_dir, args):
    dataset = JsonDataset(dataset_name)
    with open(os.path.join(output_dir, 'detections.pkl'), 'rb') as f:
        dets = pickle.load(f)
    # Override config with the one saved in the detections file
    if args.cfg_file is not None:
        core.config.merge_cfg_from_cfg(yaml.load(dets['cfg']))
    else:
        core.config._merge_a_into_b(yaml.load(dets['cfg']), cfg)
    results = task_evaluation.evaluate_all(
        dataset,
        dets['all_boxes'],
        dets['all_segms'],
        dets['all_keyps'],
        output_dir,
        use_matlab=args.matlab_eval
    )
    task_evaluation.log_copy_paste_friendly_results(results) 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:20,代码来源:reval.py

示例12: test_net_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def test_net_on_dataset(multi_gpu=False):
    output_dir = get_output_dir(training=False)
    dataset = JsonDataset(cfg.TEST.DATASET)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        all_boxes, all_segms, all_keyps = multi_gpu_test_net_on_dataset(
            num_images, output_dir)
    else:
        all_boxes, all_segms, all_keyps = test_net()
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(
        test_timer.average_time))
    # Run tracking and eval for posetrack datasets
    if dataset.name.startswith('posetrack') or dataset.name.startswith('kinetics'):
        roidb, dataset, _, _, _ = get_roidb_and_dataset(None)
        run_posetrack_tracking(output_dir, roidb)
    try:
        evaluate_all(dataset, all_boxes, all_segms, all_keyps, output_dir)
    except Exception as e:
        # Typically would crash as we don't have evaluators for each dataset
        logger.error('Evaluation crashed with exception {}'.format(e)) 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:25,代码来源:test_engine.py

示例13: generate_rpn_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def generate_rpn_on_dataset(multi_gpu=False):
    output_dir = get_output_dir(training=False)
    dataset = JsonDataset(cfg.TEST.DATASET)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        _boxes, _scores, _ids, rpn_file = multi_gpu_generate_rpn_on_dataset(
            num_images, output_dir)
    else:
        # Processes entire dataset range by default
        _boxes, _scores, _ids, rpn_file = generate_rpn_on_range()
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(
        test_timer.average_time))
    evaluate_proposal_file(dataset, rpn_file, output_dir) 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:18,代码来源:rpn_generator.py

示例14: test_net_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def test_net_on_dataset(
        args,
        dataset_name,
        proposal_file,
        output_dir,
        multi_gpu=False,
        gpu_id=0):
    """Run inference on a dataset."""
    dataset = JsonDataset(dataset_name)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        all_boxes, all_segms, all_keyps = multi_gpu_test_net_on_dataset(
            args, dataset_name, proposal_file, num_images, output_dir
        )
    else:
        all_boxes, all_segms, all_keyps = test_net(
            args, dataset_name, proposal_file, output_dir, gpu_id=gpu_id
        )
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(test_timer.average_time))
    results = task_evaluation.evaluate_all(
        dataset, all_boxes, all_segms, all_keyps, output_dir
    )
    return results 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:28,代码来源:test_engine.py

示例15: test_net_on_dataset

# 需要导入模块: from datasets import json_dataset [as 别名]
# 或者: from datasets.json_dataset import JsonDataset [as 别名]
def test_net_on_dataset(
        args,
        dataset_name,
        proposal_file,
        output_dir,
        multi_gpu=False,
        gpu_id=0):
    """Run inference on a dataset."""
    dataset = JsonDataset(dataset_name)
    test_timer = Timer()
    test_timer.tic()
    if multi_gpu:
        num_images = len(dataset.get_roidb())
        all_boxes = multi_gpu_test_net_on_dataset(
            args, dataset_name, proposal_file, num_images, output_dir
        )
    else:
        all_boxes = test_net(
            args, dataset_name, proposal_file, output_dir, gpu_id=gpu_id
        )
    test_timer.toc()
    logger.info('Total inference time: {:.3f}s'.format(test_timer.average_time))

    roidb = dataset.get_roidb()
    num_images = len(roidb)
    num_classes = cfg.MODEL.NUM_CLASSES + 1
    final_boxes = empty_results(num_classes, num_images)
    test_corloc = 'train' in dataset_name
    for i, entry in enumerate(roidb):
        boxes = all_boxes[entry['image']]
        if test_corloc:
            _, _, cls_boxes_i = box_results_for_corloc(boxes['scores'], boxes['boxes'])
        else:
            _, _, cls_boxes_i = box_results_with_nms_and_limit(boxes['scores'],
                                                         boxes['boxes'])
        extend_results(i, final_boxes, cls_boxes_i)
    results = task_evaluation.evaluate_all(
        dataset, final_boxes, output_dir, test_corloc
    )
    return results 
开发者ID:ppengtang,项目名称:pcl.pytorch,代码行数:42,代码来源:test_engine.py


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