Python datasets.pascal_voc.pascal_voc() Examples

The following are 4 code examples of datasets.pascal_voc.pascal_voc(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module datasets.pascal_voc , or try the search function .
Example #1
Source File: reval.py    From CenterNet-CondInst with MIT License 6 votes vote down vote up
def from_dets(imdb_name, detection_file, args):
  imdb = pascal_voc('test', '2007')
  imdb.competition_mode(args.comp_mode)
  imdb.config['matlab_eval'] = args.matlab_eval
  with open(os.path.join(detection_file), 'rb') as f:
    if 'json' in detection_file:
      dets = json.load(f)
    else:
      dets = pickle.load(f, encoding='latin1')
  # import pdb; pdb.set_trace()
  if args.apply_nms:
    print('Applying NMS to all detections')
    test_nms = 0.3
    nms_dets = apply_nms(dets, test_nms)
  else:
    nms_dets = dets

  print('Evaluating detections')
  imdb.evaluate_detections(nms_dets) 
Example #2
Source File: reval.py    From centerNet-deep-sort with GNU General Public License v3.0 6 votes vote down vote up
def from_dets(imdb_name, detection_file, args):
  imdb = pascal_voc('test', '2007')
  imdb.competition_mode(args.comp_mode)
  imdb.config['matlab_eval'] = args.matlab_eval
  with open(os.path.join(detection_file), 'rb') as f:
    if 'json' in detection_file:
      dets = json.load(f)
    else:
      dets = pickle.load(f, encoding='latin1')
  # import pdb; pdb.set_trace()
  if args.apply_nms:
    print('Applying NMS to all detections')
    test_nms = 0.3
    nms_dets = apply_nms(dets, test_nms)
  else:
    nms_dets = dets

  print('Evaluating detections')
  imdb.evaluate_detections(nms_dets) 
Example #3
Source File: reval.py    From CenterNet with MIT License 6 votes vote down vote up
def from_dets(imdb_name, detection_file, args):
  imdb = pascal_voc('test', '2007')
  imdb.competition_mode(args.comp_mode)
  imdb.config['matlab_eval'] = args.matlab_eval
  with open(os.path.join(detection_file), 'rb') as f:
    if 'json' in detection_file:
      dets = json.load(f)
    else:
      dets = pickle.load(f, encoding='latin1')
  # import pdb; pdb.set_trace()
  if args.apply_nms:
    print('Applying NMS to all detections')
    test_nms = 0.3
    nms_dets = apply_nms(dets, test_nms)
  else:
    nms_dets = dets

  print('Evaluating detections')
  imdb.evaluate_detections(nms_dets) 
Example #4
Source File: roidb.py    From CIOD with MIT License 5 votes vote down vote up
def combined_roidb(dataset_name, set_name, classes=None, ext=None, training=True, data_extra=None):
    """
    Combine multiple roidbs
    """

    def get_training_roidb(imdb):
        """Returns a roidb (Region of Interest database) for use in training."""
        if cfg.TRAIN.USE_FLIPPED:
            tqdm.write('Appending horizontally-flipped training examples...')
            imdb.append_flipped_images()
            tqdm.write('done')

        tqdm.write('Preparing training data...')

        prepare_roidb(imdb)
        # ratio_index = rank_roidb_ratio(imdb)
        tqdm.write('done')

        return imdb.roidb

    # Get the roidb
    imdb = pascal_voc(set_name, dataset_name, classes=classes, ext=ext, data_extra=data_extra)
    tqdm.write('Loaded dataset `{:s}` for training'.format(imdb.name))
    imdb.set_proposal_method(cfg.TRAIN.PROPOSAL_METHOD)
    tqdm.write('Set proposal method: {:s}'.format(cfg.TRAIN.PROPOSAL_METHOD))
    roidb = get_training_roidb(imdb)

    # Get the imdb
    # imdb = pascal_voc(set_name, dataset_name)

    if training:
        roidb = filter_roidb(roidb)

    ratio_list, ratio_index = rank_roidb_ratio(roidb)

    return imdb, roidb, ratio_list, ratio_index