LocalizationAnalysis.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @file LocalizationAnalysis.h
  3. * @brief Some methods for localization analysis
  4. * @author Erik Rodner
  5. * @date 09/01/2008
  6. */
  7. #ifndef LOCALIZATIONANALYSISINCLUDE
  8. #define LOCALIZATIONANALYSISINCLUDE
  9. #include <vector>
  10. #include <map>
  11. #include "LocalizationResult.h"
  12. namespace OBJREC {
  13. /** Some methods for localization analysis */
  14. class LocalizationAnalysis
  15. {
  16. protected:
  17. double trapezoidArea ( double x1, double y1, double x2, double y2 );
  18. public:
  19. /** simple constructor */
  20. LocalizationAnalysis();
  21. /** simple destructor */
  22. virtual ~LocalizationAnalysis();
  23. void matchResults ( LocalizationResult *l,
  24. const LocalizationResult *l_gt,
  25. std::vector< std::pair<double, int> > & results,
  26. double matchThreshold = 0.3,
  27. bool rejectMultipleDetections = true);
  28. void calcRecallPrecisionCurve ( const std::vector< std::pair<double, int> > & results_unsorted,
  29. int count_positives,
  30. std::vector<double> & thresholdsv,
  31. std::vector<double> & recallv,
  32. std::vector<double> & precisionv );
  33. double calcAreaUnderROC ( const std::vector<double> & fprate,
  34. const std::vector<double> & tprate );
  35. void calcROCCurve ( const std::vector< std::pair<double, int> > & results_unsorted,
  36. int count_positives,
  37. int count_negatives,
  38. std::vector<double> & thresholdsv,
  39. std::vector<double> & fprates,
  40. std::vector<double> & tprates );
  41. /** calculates the 11-point estimate of the average precision given
  42. recall and precision values (used for PASCAL VOC) */
  43. double calcAveragePrecision ( const std::vector<double> & recall,
  44. const std::vector<double> & precision );
  45. /** calculates a precise estimate of the average precision, given
  46. recall and precision values */
  47. double calcAveragePrecisionPrecise ( const std::vector<double> & recall,
  48. const std::vector<double> & precision );
  49. };
  50. } // namespace
  51. #endif