(difficulty, ignore_other_vru, results_path, det_path, gt_path, det_method_name,
             use_cache, eval_type='pedestrian')
return  mr_fppi.log_avg_mr_reference_implementation()
The actual evaluation
The actual evaluation
The actual evaluation
def evaluate(difficulty, ignore_other_vru, results_path, det_path, gt_path, det_method_name,
             use_cache, eval_type='pedestrian'):
    """The actual evaluation"""

    # path to save pickled results
    pkl_path = os.path.join(results_path,
                            'ignore={}_difficulty={}_evaltype={}.pkl'.format(ignore_other_vru,
                                                                             difficulty, eval_type))

    if os.path.exists(pkl_path) and use_cache:
        print ('# # # # # # # # # # # # # # # # # # # --- NOTE --- # # # # # # # # # # # # # # #')
        print ('Using cached result for "{}".'.format(det_path))
        print ('Cache file: {}'.format(pkl_path))
        print ('# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #')
        result = Result.load_from_disc(pkl_path)
    else:
        data = load_data_ecp(gt_path, det_path)
        evaluator = create_evaluator(data, difficulty, ignore_other_vru, eval_type)
        result = evaluator.result
        result.save_to_disc(pkl_path)

    # Miss Rate vs False Positive Per Image
    mr_fppi = statistics.MrFppi(result=result)
    # title = 'difficulty={}, ignore_other_vru={}, evaltype={}'.format(difficulty, ignore_other_vru,
    #                                                                  eval_type)
    # label = 'lamr: {}'.format(mr_fppi.log_avg_mr_reference_implementation())
    # fig = mr_fppi.create_plot(title, label)
    # filename = 'lamr_ignore={}_difficulty={}_evaltype={}'.format(ignore_other_vru, difficulty,
    #                                                              eval_type)
    # fig.savefig(os.path.join(results_path, '{}.pdf'.format(filename)))  # vector graphic
    # fig.savefig(os.path.join(results_path, '{}.png'.format(filename)))  # png
    #
    # print ('# ----------------------------------------------------------------- #')
    # print ('Finished evaluation of ' + det_method_name)
    # print ('difficulty={}, ignore_other_vru={}, evaltype={}'.format(difficulty, ignore_other_vru,
    #                                                                eval_type))
    # print ('---')
    # print ('Log-Avg Miss Rate (caltech reference implementation): ', \
    #     mr_fppi.log_avg_mr_reference_implementation())
    # print ('-')
    # print ('Processed number of frames: ', result.nof_imgs)
    # print ('Number of ignored ground truth annotations: ', \
    #     len(result.gts_including_ignored) - len(result.gts))
    # print ('Number of skipped ground truth annotations: ', result.skipped_gts['count'])
    # print ('Classes of skipped ground truth annotations: ', list(result.skipped_gts['types']))
    # print ('Number of skipped detections: ', result.skipped_dets['count'])
    # print ('Classes of skipped detections: ', list(result.skipped_dets['types']))
    # print ('# ----------------------------------------------------------------- #')
    # print ('')
    return  mr_fppi.log_avg_mr_reference_implementation()
def evaluate ( difficulty , ignore_other_vru , results_path , det_path , gt_path , det_method_name , use_cache , eval_type = 'pedestrian' ) : # path to save pickled results pkl_path = os . path . join ( results_path , 'ignore={}_difficulty={}_evaltype={}.pkl' . format ( ignore_other_vru , difficulty , eval_type ) ) if os . path . exists ( pkl_path ) and use_cache : print ( '# # # # # # # # # # # # # # # # # # # --- NOTE --- # # # # # # # # # # # # # # #' ) print ( 'Using cached result for "{}".' . format ( det_path ) ) print ( 'Cache file: {}' . format ( pkl_path ) ) print ( '# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #' ) result = Result . load_from_disc ( pkl_path ) else : data = load_data_ecp ( gt_path , det_path ) evaluator = create_evaluator ( data , difficulty , ignore_other_vru , eval_type ) result = evaluator . result result . save_to_disc ( pkl_path ) # Miss Rate vs False Positive Per Image mr_fppi = statistics . MrFppi ( result = result ) # title = 'difficulty={}, ignore_other_vru={}, evaltype={}'.format(difficulty, ignore_other_vru, #                                                                  eval_type) # label = 'lamr: {}'.format(mr_fppi.log_avg_mr_reference_implementation()) # fig = mr_fppi.create_plot(title, label) # filename = 'lamr_ignore={}_difficulty={}_evaltype={}'.format(ignore_other_vru, difficulty, #                                                              eval_type) # fig.savefig(os.path.join(results_path, '{}.pdf'.format(filename)))  # vector graphic # fig.savefig(os.path.join(results_path, '{}.png'.format(filename)))  # png # # print ('# ----------------------------------------------------------------- #') # print ('Finished evaluation of ' + det_method_name) # print ('difficulty={}, ignore_other_vru={}, evaltype={}'.format(difficulty, ignore_other_vru, #                                                                eval_type)) # print ('---') # print ('Log-Avg Miss Rate (caltech reference implementation): ', \ #     mr_fppi.log_avg_mr_reference_implementation()) # print ('-') # print ('Processed number of frames: ', result.nof_imgs) # print ('Number of ignored ground truth annotations: ', \ #     len(result.gts_including_ignored) - len(result.gts)) # print ('Number of skipped ground truth annotations: ', result.skipped_gts['count']) # print ('Classes of skipped ground truth annotations: ', list(result.skipped_gts['types'])) # print ('Number of skipped detections: ', result.skipped_dets['count']) # print ('Classes of skipped detections: ', list(result.skipped_dets['types'])) # print ('# ----------------------------------------------------------------- #') # print ('') return mr_fppi . log_avg_mr_reference_implementation ( )