MCPcopy Create free account
hub / github.com/davisking/dlib / test_sequence_segmenter

Function test_sequence_segmenter

dlib/svm/cross_validate_sequence_segmenter.h:77–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 typename sequence_type
76 >
77 const matrix<double,1,3> test_sequence_segmenter (
78 const sequence_segmenter_type& segmenter,
79 const std::vector<sequence_type>& samples,
80 const std::vector<std::vector<std::pair<unsigned long,unsigned long> > >& segments
81 )
82 {
83 // make sure requires clause is not broken
84 DLIB_ASSERT( is_sequence_segmentation_problem(samples, segments) == true,
85 "\tmatrix test_sequence_segmenter()"
86 << "\n\t invalid inputs were given to this function"
87 << "\n\t is_sequence_segmentation_problem(samples, segments): "
88 << is_sequence_segmentation_problem(samples, segments));
89
90 const matrix<double,1,3> metrics = impl::raw_metrics_test_sequence_segmenter(segmenter, samples, segments);
91
92 const double total_detections = metrics(0);
93 const double total_true_segments = metrics(1);
94 const double true_hits = metrics(2);
95
96 const double precision = (total_detections ==0) ? 1 : true_hits/total_detections;
97 const double recall = (total_true_segments==0) ? 1 : true_hits/total_true_segments;
98 const double f1 = (precision+recall ==0) ? 0 : 2*precision*recall/(precision+recall);
99
100 matrix<double,1,3> res;
101 res = precision, recall, f1;
102 return res;
103 }
104
105// ----------------------------------------------------------------------------------------
106

Callers 4

test_sequence_segmenter1Function · 0.85
test_sequence_segmenter2Function · 0.85
do_testFunction · 0.85
mainFunction · 0.85

Tested by

no test coverage detected