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)
def from_dets(imdb_name, detection_file, pascal_root, apply_nms=False): imdb = pascal_voc('test', '2007', path=pascal_root) imdb.competition_mode(False) 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 apply_nms: print('Applying NMS to all detections') test_nms = 0.3 nms_dets = apply_nms(dets, test_nms) else: nms_dets = dets avg_map = (imdb.evaluate_detections(nms_dets)) return avg_map
def from_dets(imdb_name, detection_file, args): imdb = pascal_voc('utest', '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)