mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 10:46:51 +08:00
Created new end-to-end benchmark that validates detection quality
This commit is contained in:
47
src/misc_utilities/benchmark/endtoendtest.h
Normal file
47
src/misc_utilities/benchmark/endtoendtest.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#ifndef OPENALPR_ENDTOENDTEST_H
|
||||||
|
#define OPENALPR_ENDTOENDTEST_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "opencv2/highgui/highgui.hpp"
|
||||||
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
#include "alpr_impl.h"
|
||||||
|
#include "benchmark_utils.h"
|
||||||
|
|
||||||
|
class EndToEndTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EndToEndTest(std::string inputDir, std::string outputDir);
|
||||||
|
void runTest(std::string country, std::vector<std::string> files);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool rectMatches(cv::Rect actualPlate, PlateRegion candidate);
|
||||||
|
int totalRectCount(PlateRegion rootCandidate);
|
||||||
|
|
||||||
|
std::string inputDir;
|
||||||
|
std::string outputDir;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class EndToEndBenchmarkResult {
|
||||||
|
public:
|
||||||
|
EndToEndBenchmarkResult()
|
||||||
|
{
|
||||||
|
this->imageName = "";
|
||||||
|
this->detectedPlate = false;
|
||||||
|
this->topResultCorrect = false;
|
||||||
|
this->top10ResultCorrect = false;
|
||||||
|
this->detectionFalsePositives = 0;
|
||||||
|
this->resultsFalsePositives = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string imageName;
|
||||||
|
bool detectedPlate;
|
||||||
|
bool topResultCorrect;
|
||||||
|
bool top10ResultCorrect;
|
||||||
|
int detectionFalsePositives;
|
||||||
|
int resultsFalsePositives;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //OPENALPR_ENDTOENDTEST_H
|
@@ -101,3 +101,9 @@ bool stringCompare( const std::string &left, const std::string &right )
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string filenameWithoutExtension(std::string filename)
|
||||||
|
{
|
||||||
|
int lastindex = filename.find_last_of(".");
|
||||||
|
return filename.substr(0, lastindex);
|
||||||
|
}
|
Reference in New Issue
Block a user