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


Python factory.get_imdb方法代码示例

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


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

示例1: combined_roidb

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def combined_roidb(imdb_names):
  """
  Combine multiple roidbs
  """

  def get_roidb(imdb_name):
    imdb = get_imdb(imdb_name)
    print('Loaded dataset `{:s}` for training'.format(imdb.name))
    imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD)
    print('Set proposal method: {:s}'.format(cfg.TRAIN.PROPOSAL_METHOD))
    roidb = get_training_roidb(imdb)
    return roidb

  roidbs = [get_roidb(s) for s in imdb_names.split('+')]
  roidb = roidbs[0]
  if len(roidbs) > 1:
    for r in roidbs[1:]:
      roidb.extend(r)
    tmp = get_imdb(imdb_names.split('+')[1])
    imdb = datasets.imdb.imdb(imdb_names, tmp.classes)
  else:
    imdb = get_imdb(imdb_names)
  return imdb, roidb 
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:25,代码来源:trainval_net.py

示例2: combined_roidb

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def combined_roidb(imdb_names):
    """
    Combine multiple roidbs
    """

    def get_roidb(imdb_name):
        imdb = get_imdb(imdb_name)
        print('Loaded dataset `{:s}` for training'.format(imdb.name))
        imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD)
        print('Set proposal method: {:s}'.format(cfg.TRAIN.PROPOSAL_METHOD))
        roidb = get_training_roidb(imdb)
        return roidb

    roidbs = [get_roidb(s) for s in imdb_names.split('+')]
    roidb = roidbs[0]
    if len(roidbs) > 1:
        for r in roidbs[1:]:
            roidb.extend(r)
        tmp = get_imdb(imdb_names.split('+')[1])
        imdb = datasets.imdb.imdb(imdb_names, tmp.classes)
    else:
        imdb = get_imdb(imdb_names)
    return imdb, roidb 
开发者ID:wanjinchang,项目名称:SSH-TensorFlow,代码行数:25,代码来源:trainval_net.py

示例3: combined_roidb

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def combined_roidb(imdb_names):
    def get_roidb(imdb_name):
        imdb = get_imdb(imdb_name)
        print 'Loaded dataset `{:s}` for training'.format(imdb.name)
        imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD)
        print 'Set proposal method: {:s}'.format(cfg.TRAIN.PROPOSAL_METHOD)
        roidb = get_training_roidb(imdb)
        return roidb

    roidbs = [get_roidb(s) for s in imdb_names.split('+')]
    roidb = roidbs[0]
    if len(roidbs) > 1:
        for r in roidbs[1:]:
            roidb.extend(r)
        imdb = datasets.imdb.imdb(imdb_names)
    else:
        imdb = get_imdb(imdb_names)
    return imdb, roidb 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:20,代码来源:train_net.py

示例4: combined_roidb

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def combined_roidb(imdb_names):
  """
  Combine multiple roidbs
  """

  def get_roidb(imdb_name):
    imdb = get_imdb(imdb_name)
    print('Loaded dataset `{:s}` for training'.format(imdb.name))
    roidb = get_training_roidb(imdb)
    return roidb

  roidbs = [get_roidb(s) for s in imdb_names.split('+')]
  roidb = roidbs[0]
  if len(roidbs) > 1:
    for r in roidbs[1:]:
      roidb.extend(r)
    tmp = get_imdb(imdb_names.split('+')[1])
    imdb = datasets.imdb.imdb(imdb_names, tmp.classes)
  else:
    imdb = get_imdb(imdb_names)
  return imdb, roidb 
开发者ID:endernewton,项目名称:iter-reason,代码行数:23,代码来源:trainval_memory.py

示例5: from_mats

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def from_mats(imdb_name, output_dir):
    import scipy.io as sio

    imdb = get_imdb(imdb_name)

    aps = []
    for i, cls in enumerate(imdb.classes[1:]):
        mat = sio.loadmat(os.path.join(output_dir, cls + '_pr.mat'))
        ap = mat['ap'][0, 0] * 100
        apAuC = mat['ap_auc'][0, 0] * 100
        print '!!! {} : {:.1f} {:.1f}'.format(cls, ap, apAuC)
        aps.append(ap)

    print '~~~~~~~~~~~~~~~~~~~'
    print 'Results (from mat files):'
    for ap in aps:
        print '{:.1f}'.format(ap)
    print '{:.1f}'.format(np.array(aps).mean())
    print '~~~~~~~~~~~~~~~~~~~' 
开发者ID:tanshen,项目名称:SubCNN,代码行数:21,代码来源:reval.py

示例6: from_dets

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def from_dets(imdb_name, output_dir, args):
  imdb = get_imdb(imdb_name)
  imdb.competition_mode(args.comp_mode)
  imdb.config['matlab_eval'] = args.matlab_eval
  with open(os.path.join(output_dir, 'detections.pkl'), 'rb') as f:
    dets = pickle.load(f)

  if args.apply_nms:
    print('Applying NMS to all detections')
    nms_dets = apply_nms(dets, cfg.TEST.NMS)
  else:
    nms_dets = dets

  print('Evaluating detections')
  imdb.evaluate_detections(nms_dets, output_dir) 
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:17,代码来源:reval.py

示例7: from_dets

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def from_dets(imdb_name, output_dir, args):
  imdb = get_imdb(imdb_name)
  imdb.competition_mode(args.comp_mode)
  with open(os.path.join(output_dir, 'discovery.pkl'), 'rb') as f:
    dets = pickle.load(f)


  print('Evaluating detections')
  imdb.evaluate_discovery(dets, output_dir) 
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:11,代码来源:reval_discovery.py

示例8: get_roidb

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def get_roidb(imdb_name, rpn_file=None):
    imdb = get_imdb(imdb_name)
    print 'Loaded dataset `{:s}` for training'.format(imdb.name)
    imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD)
    print 'Set proposal method: {:s}'.format(cfg.TRAIN.PROPOSAL_METHOD)
    if rpn_file is not None:
        imdb.config['rpn_file'] = rpn_file
    roidb = get_training_roidb(imdb)
    return roidb, imdb 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:11,代码来源:train_faster_rcnn_alt_opt.py

示例9: rpn_generate

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def rpn_generate(queue=None, imdb_name=None, rpn_model_path=None, cfg=None,
                 rpn_test_prototxt=None):
    """Use a trained RPN to generate proposals.
    """

    cfg.TEST.RPN_PRE_NMS_TOP_N = -1     # no pre NMS filtering
    cfg.TEST.RPN_POST_NMS_TOP_N = 2000  # limit top boxes after NMS
    print 'RPN model: {}'.format(rpn_model_path)
    print('Using config:')
    pprint.pprint(cfg)

    import caffe
    _init_caffe(cfg)

    # NOTE: the matlab implementation computes proposals on flipped images, too.
    # We compute them on the image once and then flip the already computed
    # proposals. This might cause a minor loss in mAP (less proposal jittering).
    imdb = get_imdb(imdb_name)
    print 'Loaded dataset `{:s}` for proposal generation'.format(imdb.name)

    # Load RPN and configure output directory
    rpn_net = caffe.Net(rpn_test_prototxt, rpn_model_path, caffe.TEST)
    output_dir = get_output_dir(imdb)
    print 'Output will be saved to `{:s}`'.format(output_dir)
    # Generate proposals on the imdb
    rpn_proposals = imdb_proposals(rpn_net, imdb)
    # Write proposals to disk and send the proposal file path through the
    # multiprocessing queue
    rpn_net_name = os.path.splitext(os.path.basename(rpn_model_path))[0]
    rpn_proposals_path = os.path.join(
        output_dir, rpn_net_name + '_proposals.pkl')
    with open(rpn_proposals_path, 'wb') as f:
        cPickle.dump(rpn_proposals, f, cPickle.HIGHEST_PROTOCOL)
    print 'Wrote RPN proposals to {}'.format(rpn_proposals_path)
    queue.put({'proposal_path': rpn_proposals_path}) 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:37,代码来源:train_faster_rcnn_alt_opt.py

示例10: from_dets

# 需要导入模块: from datasets import factory [as 别名]
# 或者: from datasets.factory import get_imdb [as 别名]
def from_dets(imdb_name, output_dir, args):
    imdb = get_imdb(imdb_name)
    imdb.competition_mode(args.comp_mode)
    imdb.config['matlab_eval'] = args.matlab_eval
    with open(os.path.join(output_dir, 'detections.pkl'), 'rb') as f:
        dets = cPickle.load(f)

    if args.apply_nms:
        print 'Applying NMS to all detections'
        nms_dets = apply_nms(dets, cfg.TEST.NMS)
    else:
        nms_dets = dets

    print 'Evaluating detections'
    imdb.evaluate_detections(nms_dets, output_dir) 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:17,代码来源:reval.py


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