ClassificationResult.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * @file ClassificationResult.cpp
  3. * @brief classification result, what else?
  4. * @author Erik Rodner
  5. * @date 02/13/2008
  6. */
  7. #include "core/image/ImageT.h"
  8. #include "core/vector/VectorT.h"
  9. #include "core/vector/MatrixT.h"
  10. #include <iostream>
  11. #include "vislearning/cbaselib/ClassificationResult.h"
  12. using namespace OBJREC;
  13. using namespace std;
  14. using namespace NICE;
  15. ClassificationResult::ClassificationResult ( int _rejection_status, int maxClassNo ) : scores ( maxClassNo + 1 )
  16. {
  17. rejection_status = _rejection_status;
  18. classno = -1;
  19. classno_groundtruth = -1;
  20. classname = "rejected";
  21. uncertainty = 0.0;
  22. }
  23. ClassificationResult::ClassificationResult ( int _classno, double _score, int maxClassNo ) : scores ( maxClassNo + 1 )
  24. {
  25. rejection_status = REJECTION_NONE;
  26. classno = _classno;
  27. scores[classno] = _score;
  28. classname = "unknown";
  29. classno_groundtruth = -1;
  30. uncertainty = 0.0;
  31. }
  32. ClassificationResult::ClassificationResult ( int _classno,
  33. const FullVector & _scores
  34. )
  35. {
  36. this->rejection_status = REJECTION_NONE;
  37. this->classno = _classno;
  38. this->scores = _scores;
  39. this->classname = "unknown";
  40. this->classno_groundtruth = -1;
  41. this->uncertainty = 0.0;
  42. }
  43. ClassificationResult::ClassificationResult ( int _classno,
  44. const SparseVector & _scores
  45. )
  46. {
  47. throw("No conversion from SparseVector to FullVector available. Aborting!");
  48. this->rejection_status = REJECTION_NONE;
  49. this->classno = _classno;
  50. this->classname = "unknown";
  51. this->classno_groundtruth = -1;
  52. this->uncertainty = 0.0;
  53. }
  54. ClassificationResult::~ClassificationResult()
  55. {
  56. }
  57. double ClassificationResult::confidence () const
  58. {
  59. return scores.get ( classno );
  60. }
  61. bool ClassificationResult::ok () const
  62. {
  63. return ( rejection_status == REJECTION_NONE );
  64. }