當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。