-
Notifications
You must be signed in to change notification settings - Fork 4
/
SegmentationEvaluation.h
77 lines (60 loc) · 3.11 KB
/
SegmentationEvaluation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef SegmentationEvaluation_h
#define SegmentationEvaluation_h
//============================================================================
/**
Template class calculating the segmentation scores.
@author Johan Pauwels
@date 20131008
*/
//============================================================================
#include <vector>
#include <Eigen/Core>
#include "MusOO/TimedLabel.h"
class SegmentationEvaluation
{
public:
typedef std::vector<MusOO::TimedLabel<std::string> > LabelSequence;
/** Default constructor. */
SegmentationEvaluation(const std::string& inVariant, const std::vector<double>& inTolerances);
void reset();
void addSequencePair(const LabelSequence& inRefSequence, const LabelSequence& inTestSequence/*, double inStartTime, double inEndTime, std::ostream& inVerboseOStream, const double inDelay = 0.*/);
// Get results of last file
const double getDuration() const;
const Eigen::ArrayXd::Index getNumRefSegments() const;
const Eigen::ArrayXd::Index getNumTestSegments() const;
const double getUnderSegmentation() const;
const double getOverSegmentation() const;
const double getCombinedHammingMeasureWorst() const;
const double getCombinedHammingMeasureHarmonic() const;
// Reductions over data set
const double calcTotalDuration() const;
const double calcAverageNumRefSegments() const;
const double calcAverageNumTestSegments() const;
const double calcAverageSegmentsRatio() const;
const double calcAverageUnderSegmentation() const;
const double calcWeightedAverageUnderSegmentation() const;
const double calcAverageOverSegmentation() const;
const double calcWeightedAverageOverSegmentation() const;
const double calcAverageCombinedHammingMeasureWorst() const;
const double calcWeightedAverageCombinedHammingMeasureWorst() const;
const double calcAverageCombinedHammingMeasureHarmonic() const;
const double calcWeightedAverageCombinedHammingMeasureHarmonic() const;
protected:
void segmentationScores(const Eigen::ArrayXd& inRefTimeStamps, const Eigen::ArrayXd& inTestTimeStamps, Eigen::ArrayXd& outRecalls, Eigen::ArrayXd& outPrecisions);
const double missedBoundaries(const Eigen::ArrayXd& inRefOnsets, const Eigen::ArrayXd& inRefOffsets, const Eigen::ArrayXd& inTestOnsets, const Eigen::ArrayXd& inTestOffsets);
const double segmentFragmentation(const Eigen::ArrayXd& inRefOnsets, const Eigen::ArrayXd& inRefOffsets, const Eigen::ArrayXd& inTestOnsets, const Eigen::ArrayXd& inTestOffsets);
const std::string m_Variant;
const std::vector<double> m_Tolerances;
std::vector<double> m_Durations;
std::vector<Eigen::ArrayXd::Index> m_NumRefSegments;
std::vector<Eigen::ArrayXd::Index> m_NumTestSegments;
std::vector<Eigen::ArrayXd> m_Recalls;
std::vector<Eigen::ArrayXd> m_Precisions;
std::vector<Eigen::ArrayXd> m_Fmeasures;
std::vector<double> m_MissedBoundaries;
std::vector<double> m_SegmentFragmentations;
std::vector<double> m_CombinedHammingMeasureWorst;
std::vector<double> m_CombinedHammingMeasureHarmonic;
private:
};
#endif