* add grid_search for automatic choose the best parameters for algorithm.

v1.6alpha
liuruoze 9 years ago committed by Micooz
parent d3d063266a
commit 4520282957

@ -2,5 +2,6 @@
BatchTest Option:
1. general_test;
2. native_test;
3. 返回;
3. grid_search (experiment);
4. 返回;
////////////////////////////////////

@ -0,0 +1,96 @@
//////////////////////////////////////////////////////////////////////////
// Name: params Header
// Version: 1.0
// Date: 2016-07-01
// Author: liuruoze
// Copyright: liuruoze
// Desciption:
// An abstract class for runtime algorithm params in easypr.
//////////////////////////////////////////////////////////////////////////
#ifndef EASYPR_CORE_PARAMS_H_
#define EASYPR_CORE_PARAMS_H_
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CParams {
public:
static CParams* instance();
CParams(const CParams& other) {
m_isUpdate = other.m_isUpdate;
m_param1f = other.m_param1f;
m_param2f = other.m_param2f;
m_param3f = other.m_param3f;
m_param1i = other.m_param1i;
m_param2i = other.m_param2i;
m_param3i = other.m_param3i;
m_param1b = other.m_param1b;
m_param2b = other.m_param2b;
m_param3b = other.m_param3b;
}
inline void setIsUpdate(bool param) { m_isUpdate = param; }
inline bool getIsUpdate() const { return m_isUpdate; }
inline void setParam1f(float param) { m_param1f = param; }
inline float getParam1f() const { return m_param1f; }
inline void setParam2f(float param) { m_param2f = param; }
inline float getParam2f() const { return m_param2f; }
inline void setParam3f(float param) { m_param3f = param; }
inline float getParam3f() const { return m_param3f; }
inline void setParam1i(int param) { m_param1i = param; }
inline int getParam1i() const { return m_param1i; }
inline void setParam2i(int param) { m_param2i = param; }
inline int getParam2i() const { return m_param2i; }
inline void setParam3i(int param) { m_param3i = param; }
inline int getParam3i() const { return m_param3i; }
inline void setParam1b(bool param) { m_param1b = param; }
inline bool getParam1b() const { return m_param1b; }
inline void setParam2b(bool param) { m_param2b = param; }
inline bool getParam2b() const { return m_param2b; }
inline void setParam3b(bool param) { m_param3b = param; }
inline bool getParam3b() const { return m_param3b; }
private:
CParams() {
m_isUpdate = false;
}
static CParams* instance_;
// weather update;
bool m_isUpdate;
//! float params
float m_param1f;
float m_param2f;
float m_param3f;
//! int params
int m_param1i;
int m_param2i;
int m_param3i;
//! bool params
bool m_param1b;
bool m_param2b;
bool m_param3b;
};
} /*! \namespace easypr*/
#endif // EASYPR_CORE_PARAMS_H_

File diff suppressed because it is too large Load Diff

@ -15,13 +15,13 @@
<image>
<imageName>´¨A105LR</imageName>
<taggedRectangles>
<taggedRectangle x="339" y="312" width="146" height="37" rotation="2" locateType="2">蓝牌:陕AY05LR</taggedRectangle>
<taggedRectangle x="339" y="312" width="146" height="37" rotation="2" locateType="2">À¶ÅÆ:´¨AY05LR</taggedRectangle>
</taggedRectangles>
</image>
<image>
<imageName>´¨A113YP</imageName>
<taggedRectangles>
<taggedRectangle x="346" y="207" width="138" height="33" rotation="0" locateType="2">蓝牌:豫A113YP</taggedRectangle>
<taggedRectangle x="346" y="207" width="138" height="33" rotation="0" locateType="2">À¶ÅÆ:´¨A113YP</taggedRectangle>
</taggedRectangles>
</image>
<image>
@ -111,7 +111,7 @@
<image>
<imageName>´¨AZ408T</imageName>
<taggedRectangles>
<taggedRectangle x="298" y="319" width="138" height="40" rotation="-1" locateType="2">蓝牌:陕MA7408</taggedRectangle>
<taggedRectangle x="298" y="319" width="138" height="40" rotation="-1" locateType="2">À¶ÅÆ:¶õMA7408</taggedRectangle>
</taggedRectangles>
</image>
<image>
@ -127,7 +127,7 @@
<image>
<imageName>»¦ALB022</imageName>
<taggedRectangles>
<taggedRectangle x="392" y="390" width="126" height="31" rotation="-3" locateType="2">蓝牌:沪ALB022</taggedRectangle>
<taggedRectangle x="392" y="390" width="126" height="31" rotation="-3" locateType="2">À¶ÅÆ:ÁÉALB022</taggedRectangle>
</taggedRectangles>
</image>
<image>
@ -139,7 +139,7 @@
<image>
<imageName>»¦D71603</imageName>
<taggedRectangles>
<taggedRectangle x="425" y="417" width="608" height="139" rotation="3" locateType="2">蓝牌:沪D71603</taggedRectangle>
<taggedRectangle x="425" y="417" width="608" height="139" rotation="3" locateType="2">À¶ÅÆ:¸ÊD71603</taggedRectangle>
</taggedRectangles>
</image>
<image>
@ -179,7 +179,7 @@
<image>
<imageName>ÓåBE7773</imageName>
<taggedRectangles>
<taggedRectangle x="841" y="362" width="209" height="65" rotation="13" locateType="2">蓝牌:新6E7743</taggedRectangle>
<taggedRectangle x="841" y="362" width="209" height="65" rotation="13" locateType="2">À¶ÅÆ:ÉÂ6E7743</taggedRectangle>
<taggedRectangle x="695" y="26" width="113" height="25" rotation="-14" locateType="2">À¶ÅÆ</taggedRectangle>
</taggedRectangles>
</image>
@ -194,7 +194,7 @@
<imageName>ÔÁA5DP12</imageName>
<taggedRectangles>
<taggedRectangle x="1121" y="748" width="181" height="46" rotation="-4" locateType="2">À¶ÅÆ:ÔÁA5DP11</taggedRectangle>
<taggedRectangle x="1692" y="894" width="226" height="51" rotation="0" locateType="2">蓝牌:赣80002</taggedRectangle>
<taggedRectangle x="1692" y="894" width="226" height="51" rotation="0" locateType="2">À¶ÅÆ:½ú80002</taggedRectangle>
</taggedRectangles>
</image>
<image>
@ -234,7 +234,7 @@
<image>
<imageName>ÔÁSK903B</imageName>
<taggedRectangles>
<taggedRectangle x="1700" y="894" width="245" height="49" rotation="0" locateType="2">蓝牌:吉75G2Z</taggedRectangle>
<taggedRectangle x="1700" y="894" width="245" height="49" rotation="0" locateType="2">À¶ÅÆ:»¦75G2Z</taggedRectangle>
<taggedRectangle x="1355" y="769" width="241" height="58" rotation="0" locateType="2">À¶ÅÆ:ÔÁSK903B</taggedRectangle>
</taggedRectangles>
</image>
@ -264,7 +264,7 @@
<image>
<imageName>ËÕAD6A99</imageName>
<taggedRectangles>
<taggedRectangle x="487" y="395" width="255" height="51" rotation="-2" locateType="2">蓝牌:苏AD6A99</taggedRectangle>
<taggedRectangle x="487" y="395" width="255" height="51" rotation="-2" locateType="2">À¶ÅÆ:ÃÉAD6A99</taggedRectangle>
</taggedRectangles>
</image>
<image>

@ -2142,3 +2142,63 @@ Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:62.1622%, 1-error:72.973%, Chinese-precise:72.973%
总时间:240秒, 平均执行时间:4.8秒
2016-06-30 19:56:43
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:62.1622%, 1-error:72.973%, Chinese-precise:72.973%
总时间:195秒, 平均执行时间:3.9秒
2016-06-30 20:00:49
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:54.0541%, 1-error:67.5676%, Chinese-precise:72.973%
总时间:197秒, 平均执行时间:3.94秒
2016-06-30 20:04:38
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:45.9459%, 1-error:54.0541%, Chinese-precise:59.4595%
总时间:193秒, 平均执行时间:3.86秒
2016-06-30 20:08:47
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:56.7568%, 1-error:70.2703%, Chinese-precise:75.6757%
总时间:189秒, 平均执行时间:3.78秒
2016-06-30 20:22:17
总图片数:200, Plates count:238, 未识出图片:39, 定位率:83.6134%
Recall:75.0823%, Precise:75.5011%, Fscore:75.2912%.
0-error:50.5319%, 1-error:56.9149%, Chinese-precise:59.0425%
总时间:792秒, 平均执行时间:3.96秒
2016-06-30 20:38:39
总图片数:200, Plates count:238, 未识出图片:39, 定位率:83.6134%
Recall:75.0823%, Precise:75.5011%, Fscore:75.2912%.
0-error:58.5106%, 1-error:65.9574%, Chinese-precise:68.0851%
总时间:791秒, 平均执行时间:3.955秒
2016-06-30 21:50:17
总图片数:200, Plates count:238, 未识出图片:39, 定位率:83.6134%
Recall:75.0823%, Precise:75.5011%, Fscore:75.2912%.
0-error:46.2766%, 1-error:52.1277%, Chinese-precise:53.7234%
总时间:702秒, 平均执行时间:3.51秒
2016-06-30 21:59:06
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:62.1622%, 1-error:72.973%, Chinese-precise:72.973%
总时间:186秒, 平均执行时间:3.72秒
2016-06-30 22:43:34
总图片数:200, Plates count:238, 未识出图片:39, 定位率:83.6134%
Recall:75.0823%, Precise:75.5011%, Fscore:75.2912%.
0-error:59.0426%, 1-error:66.4894%, Chinese-precise:68.617%
总时间:706秒, 平均执行时间:3.53秒
2016-06-30 22:58:58
总图片数:200, Plates count:238, 未识出图片:39, 定位率:83.6134%
Recall:75.0823%, Precise:75.5011%, Fscore:75.2912%.
0-error:60.1064%, 1-error:69.6809%, Chinese-precise:71.8085%
总时间:732秒, 平均执行时间:3.66秒
2016-07-01 10:12:58
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:62.1622%, 1-error:72.973%, Chinese-precise:72.973%
总时间:169秒, 平均执行时间:3.38秒
2016-07-01 10:15:39
总图片数:50, Plates count:52, 未识出图片:10, 定位率:80.7692%
Recall:72.5576%, Precise:70.7495%, Fscore:71.6422%.
0-error:56.7568%, 1-error:70.2703%, Chinese-precise:70.2703%
总时间:161秒, 平均执行时间:3.22秒

@ -0,0 +1,20 @@
2016-07-01 10:15:39
------------------
m_picturesCount:50, m_platesCount:52, m_detectRate:80.7692%.
m_detectRecall:72.5576%, m_detectPrecise:70.7495%, m_detectFscore:71.6422%.
m_0error:62.1622%, m_1error:72.973%, m_chinesePrecise:72.973%.
m_seconds:169sec, m_avgSeconds:3.38sec.
m_param1f:0.1,
m_param1b:1,
2016-07-01 10:15:39
------------------
m_picturesCount:50, m_platesCount:52, m_detectRate:80.7692%.
m_detectRecall:72.5576%, m_detectPrecise:70.7495%, m_detectFscore:71.6422%.
m_0error:56.7568%, m_1error:70.2703%, m_chinesePrecise:70.2703%.
m_seconds:161sec, m_avgSeconds:3.22sec.
m_param1f:0.2,
m_param1b:1,

@ -1,5 +1,6 @@
#include "easypr/core/chars_segment.h"
#include "easypr/core/chars_identify.h"
#include "easypr/core/params.h"
#include "easypr/config.h"
using namespace std;
@ -134,7 +135,7 @@ void CCharsSegment::judgeChinese(Mat in, Mat& out, Color plateType) {
}
bool slideChineseWindow(Mat& image, Rect mr, Mat& newRoi, Color plateType, float slideLengthRatio) {
bool slideChineseWindow(Mat& image, Rect mr, Mat& newRoi, Color plateType, float slideLengthRatio, bool useAdapThreshold) {
std::vector<CCharacter> charCandidateVec;
Rect maxrect = mr;
@ -181,8 +182,14 @@ bool slideChineseWindow(Mat& image, Rect mr, Mat& newRoi, Color plateType, float
threshold(auxRoi, roiOstu, 0, 255, CV_THRESH_OTSU + CV_THRESH_BINARY);
}
roiOstu = preprocessChar(roiOstu, kChineseSize);
CCharacter charCandidateOstu;
charCandidateOstu.setCharacterPos(rect);
charCandidateOstu.setCharacterMat(roiOstu);
charCandidateOstu.setIsChinese(isChinese);
charCandidateVec.push_back(charCandidateOstu);
}
if (1) {
if (useAdapThreshold) {
if (BLUE == plateType) {
adaptiveThreshold(auxRoi, roiAdap, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 3, 0);
}
@ -196,19 +203,14 @@ bool slideChineseWindow(Mat& image, Rect mr, Mat& newRoi, Color plateType, float
adaptiveThreshold(auxRoi, roiAdap, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 3, 0);
}
roiAdap = preprocessChar(roiAdap, kChineseSize);
CCharacter charCandidateAdap;
charCandidateAdap.setCharacterPos(rect);
charCandidateAdap.setCharacterMat(roiAdap);
charCandidateAdap.setIsChinese(isChinese);
charCandidateVec.push_back(charCandidateAdap);
}
CCharacter charCandidateOstu;
charCandidateOstu.setCharacterPos(rect);
charCandidateOstu.setCharacterMat(roiOstu);
charCandidateOstu.setIsChinese(isChinese);
charCandidateVec.push_back(charCandidateOstu);
CCharacter charCandidateAdap;
charCandidateAdap.setCharacterPos(rect);
charCandidateAdap.setCharacterMat(roiAdap);
charCandidateAdap.setIsChinese(isChinese);
charCandidateVec.push_back(charCandidateAdap);
}
CharsIdentify::instance()->classifyChinese(charCandidateVec);
@ -372,6 +374,7 @@ int CCharsSegment::charsSegment(Mat input, vector<Mat>& resultVec, Color color)
// 开始截取每个字符
bool useSlideWindow = true;
bool useAdapThreshold = CParams::instance()->getParam1b();
for (size_t i = 0; i < newSortedRect.size(); i++) {
Rect mr = newSortedRect[i];
@ -384,8 +387,9 @@ int CCharsSegment::charsSegment(Mat input, vector<Mat>& resultVec, Color color)
if (i == 0) {
if (useSlideWindow) {
float slideLengthRatio = 0.1f;
if (!slideChineseWindow(input_grey, mr, newRoi, plateType, slideLengthRatio))
//float slideLengthRatio = 0.1f;
float slideLengthRatio = CParams::instance()->getParam1f();
if (!slideChineseWindow(input_grey, mr, newRoi, plateType, slideLengthRatio, useAdapThreshold))
judgeChinese(auxRoi, newRoi, plateType);
}
else

@ -0,0 +1,12 @@
#include "easypr/core/params.h"
namespace easypr {
CParams* CParams::instance_ = nullptr;
CParams* CParams::instance() {
if (!instance_) {
instance_ = new CParams;
}
return instance_;
}
}/*! \namespace easypr*/

@ -10,6 +10,9 @@
#include "easypr/core/core_func.h"
#include "easypr/util/util.h"
#include "thirdparty/xmlParser/xmlParser.h"
#include "easypr/core/params.h"
#include "config.hpp"
#include "result.hpp"
using namespace std;
@ -61,7 +64,7 @@ namespace easypr {
return 0;
}
int accuracyTest(const char* test_path) {
int accuracyTest(const char* test_path, Result& result = Result(), bool useParams = false) {
std::shared_ptr<easypr::Kv> kv(new easypr::Kv);
kv->load("etc/chinese_mapping");
@ -351,6 +354,9 @@ namespace easypr {
}
time(&end);
// the xml detection result
xMainNode.writeToFile(path_result.c_str());
cout << "------------------" << endl;
cout << "Easypr accuracy test end!" << endl;
cout << "------------------" << endl;
@ -359,8 +365,6 @@ namespace easypr {
cout << kv->get("sum_pictures") << ":" << count_all << ", ";
cout << "Plates count" << ":" << all_plate_count << ", ";
xMainNode.writeToFile(path_result.c_str());
float count_detect = float(all_plate_count - count_nodetect);
float count_rate = count_detect / all_plate_count;
cout << kv->get("locate_rate") << ":" << count_rate * 100 << "% " << endl;
@ -414,9 +418,28 @@ namespace easypr {
}
cout << endl;
*/
// set the result.
if (useParams) {
result.setPicturesCount(count_all);
result.setPlatesCount((int)all_plate_count);
result.setDetectRate((float)count_rate * 100);
result.setDetectRecall((float)recall_2003_result * 100);
result.setDetectPrecise((float)precise_2003_result * 100);
result.setDetectFscore((float)fscore_2003_result * 100);
result.setZeroError((float)non_error_rate * 100);
result.setOneError((float)one_error_rate * 100);
result.setChinesePreciese((float)(1 - chinese_error_rate) * 100);
result.setSeconds((float)seconds);
result.setAvgSeconds((float)avgsec);
}
cout << "------------------" << endl;
ofstream myfile("accuracy.txt", ios::app);
ofstream myfile("result/accuracy.txt", ios::app);
if (myfile.is_open()) {
time_t t = time(0); // get time now
struct tm* now = localtime(&t);
@ -448,7 +471,69 @@ namespace easypr {
return 0;
}
int gridSearchTest(const char* test_path) {
std::vector<Result> all_results;
bool b1[] = {true};
int b1_c = 1;
float f1[] = {0.1f, 0.2f};
int f1_c = 2;
Config config;
config.setParam1b(b1, b1_c);
config.setParam1f(f1, f1_c);
for (size_t i1 = 0; i1 < config.getParam1b().size(); i1++) {
bool b1 = config.getParam1b().at(i1);
for (size_t i2 = 0; i2 < config.getParam1f().size(); i2++) {
float f1 = config.getParam1f().at(i2);
CParams::instance()->setParam1b(b1);
CParams::instance()->setParam1f(f1);
Result result;
accuracyTest(test_path, result, true);
result.getParams().setParam1b(b1);
result.getParams().setParam1f(f1);
all_results.push_back(result);
}
}
std::sort(all_results.begin(), all_results.end(),
[](const Result& r1, const Result& r2) {
return r1.getChinesePreciese() > r2.getChinesePreciese();
});
for (auto result : all_results) {
std::cout << result << std::endl;
ofstream myfile("result/gridSearch.txt", ios::app);
if (myfile.is_open()) {
time_t t = time(0); // get time now
struct tm* now = localtime(&t);
char buf[80];
strftime(buf, sizeof(buf), "%Y-%m-%d %X", now);
myfile << string(buf) << endl;
myfile << result << std::endl;
myfile.close();
}
}
return 0;
}
}
}
#endif // EASYPR_ACCURACY_HPP

@ -0,0 +1,81 @@
#ifndef EASYPR_CONFIG_HPP
#define EASYPR_CONFIG_HPP
#include <vector>
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
namespace demo {
class Config {
public:
Config() {
}
Config(const Config& other) {
m_param1f.assign(other.m_param1f.begin(), other.m_param1f.end());
m_param2f.assign(other.m_param2f.begin(), other.m_param2f.end());
m_param3f.assign(other.m_param3f.begin(), other.m_param3f.end());
m_param1i.assign(other.m_param1i.begin(), other.m_param1i.end());
m_param2i.assign(other.m_param2i.begin(), other.m_param2i.end());
m_param3i.assign(other.m_param3i.begin(), other.m_param3i.end());
m_param1b.assign(other.m_param1b.begin(), other.m_param1b.end());
m_param2b.assign(other.m_param2b.begin(), other.m_param2b.end());
m_param3b.assign(other.m_param3b.begin(), other.m_param3b.end());
}
inline void setParam1f(float* param, int size) { m_param1f.assign(param, param + size); }
inline std::vector<float>& getParam1f() { return m_param1f; }
inline void setParam2f(float* param, int size) { m_param2f.assign(param, param + size); }
inline std::vector<float>& getParam2f() { return m_param2f; }
inline void setParam3f(float* param, int size) { m_param3f.assign(param, param + size); }
inline std::vector<float>& getParam3f() { return m_param3f; }
inline void setParam1i(int* param, int size) { m_param1i.assign(param, param + size); }
inline std::vector<int>& getParam1i() { return m_param1i; }
inline void setParam2i(int* param, int size) { m_param2i.assign(param, param + size); }
inline std::vector<int>& getParam2i() { return m_param2i; }
inline void setParam3i(int* param, int size) { m_param3i.assign(param, param + size); }
inline std::vector<int>& getParam3i() { return m_param3i; }
inline void setParam1b(bool* param, int size) { m_param1b.assign(param, param + size); }
inline std::vector<bool>& getParam1b() { return m_param1b; }
inline void setParam2b(bool* param, int size) { m_param2b.assign(param, param + size); }
inline std::vector<bool>& getParam2b() { return m_param2b; }
inline void setParam3b(bool* param, int size) { m_param3b.assign(param, param + size); }
inline std::vector<bool>& getParam3b() { return m_param3b; }
private:
//! float params
std::vector<float> m_param1f;
std::vector<float> m_param2f;
std::vector<float> m_param3f;
//! int params
std::vector<int> m_param1i;
std::vector<int> m_param2i;
std::vector<int> m_param3i;
//! bool params
std::vector<bool> m_param1b;
std::vector<bool> m_param2b;
std::vector<bool> m_param3b;
};
} /*! \namespace demo*/
} /*! \namespace easypr*/
#endif // EASYPR_CONFIG_HPP

@ -32,7 +32,10 @@ int accuracyTestMain() {
case 2:
accuracyTest("resources/image/native_test");
break;
case 3:
case 3:
gridSearchTest("resources/image/native_test");
break;
case 4:
isExit = true;
break;
default:
@ -383,7 +386,7 @@ int main(int argc, const char* argv[]) {
}
break;
case 5:
easypr::preprocess::generate_gdts();
easypr::preprocess::generate_gdts();
break;
case 6: {
easypr::Utils::print_file_lines("etc/dev_team");

@ -0,0 +1,209 @@
#ifndef EASYPR_RESULT_HPP
#define EASYPR_RESULT_HPP
#include <vector>
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
namespace demo {
class Result {
class Params {
public:
Params() {
}
Params(const Params& other) {
m_param1f = other.m_param1f;
m_param2f = other.m_param2f;
m_param3f = other.m_param3f;
m_param1i = other.m_param1i;
m_param2i = other.m_param2i;
m_param3i = other.m_param3i;
m_param1b = other.m_param1b;
m_param2b = other.m_param2b;
m_param3b = other.m_param3b;
}
inline void setParam1f(float param) { m_param1f = param; }
inline float getParam1f() const { return m_param1f; }
inline void setParam2f(float param) { m_param2f = param; }
inline float getParam2f() const { return m_param2f; }
inline void setParam3f(float param) { m_param3f = param; }
inline float getParam3f() const { return m_param3f; }
inline void setParam1i(int param) { m_param1i = param; }
inline int getParam1i() const { return m_param1i; }
inline void setParam2i(int param) { m_param2i = param; }
inline int getParam2i() const { return m_param2i; }
inline void setParam3i(int param) { m_param3i = param; }
inline int getParam3i() const { return m_param3i; }
inline void setParam1b(bool param) { m_param1b = param; }
inline bool getParam1b() const { return m_param1b; }
inline void setParam2b(bool param) { m_param2b = param; }
inline bool getParam2b() const { return m_param2b; }
inline void setParam3b(bool param) { m_param3b = param; }
inline bool getParam3b() const { return m_param3b; }
friend std::ostream& operator << (std::ostream& os, const Params& obj)
{
// write obj to stream
os << "m_param1f" << ":" << obj.m_param1f << ", ";
//os << "m_param2f" << ":" << obj.m_param2f << ", ";
//os << "m_param3f" << ":" << obj.m_param3f << ", ";
os << std::endl;
//os << "m_param1i" << ":" << obj.m_param1i << ", ";
//os << "m_param2i" << ":" << obj.m_param2i << ", ";
//os << "m_param3i" << ":" << obj.m_param3i << ", ";
//os << std::endl;
os << "m_param1b" << ":" << obj.m_param1b << ", ";
//os << "m_param2b" << ":" << obj.m_param2b << ", ";
//os << "m_param3b" << ":" << obj.m_param3b << ", ";
os << std::endl;
return os;
}
private:
//! float params
float m_param1f;
float m_param2f;
float m_param3f;
//! int params
int m_param1i;
int m_param2i;
int m_param3i;
//! bool params
bool m_param1b;
bool m_param2b;
bool m_param3b;
};
public:
Result() {
}
Result(const Result& other) {
m_picturesCount = other.m_picturesCount;
m_platesCount = other.m_platesCount;
m_detectRate = other.m_detectRate;
m_detectRecall = other.m_detectRecall;
m_detectPrecise = other.m_detectPrecise;
m_detectFscore = other.m_detectFscore;
m_0error = other.m_0error;
m_1error = other.m_1error;
m_chinesePrecise = other.m_chinesePrecise;
m_seconds = other.m_seconds;
m_avgSeconds = other.m_avgSeconds;
m_params = other.m_params;
}
inline void setPicturesCount(int param) { m_picturesCount = param; }
inline int getPicturesCount() const { return m_picturesCount; }
inline void setPlatesCount(int param) { m_platesCount = param; }
inline int getPlatesCount() const { return m_platesCount; }
inline void setDetectRate(float param) { m_detectRate = param; }
inline float getDetectRate() const { return m_detectRate; }
inline void setDetectRecall(float param) { m_detectRecall = param; }
inline float getDetectRecall() const { return m_detectRecall; }
inline void setDetectPrecise(float param) { m_detectPrecise = param; }
inline float getDetectPrecise() const { return m_detectPrecise; }
inline void setDetectFscore(float param) { m_detectFscore = param; }
inline float getDetectFscore() const { return m_detectFscore; }
inline void setZeroError(float param) { m_0error = param; }
inline float getZeroError() const { return m_0error; }
inline void setOneError(float param) { m_1error = param; }
inline float getOneError() const { return m_1error; }
inline void setChinesePreciese(float param) { m_chinesePrecise = param; }
inline float getChinesePreciese() const { return m_chinesePrecise; }
inline void setSeconds(float param) { m_seconds = param; }
inline float getSeconds() const { return m_seconds; }
inline void setAvgSeconds(float param) { m_avgSeconds = param; }
inline float getAvgSeconds() const { return m_avgSeconds; }
inline void setParams(Params param) { m_params = param; }
inline Params& getParams() { return m_params; }
friend std::ostream& operator<<(std::ostream& os, const Result& obj)
{
// write obj to stream
os << "------------------" << std::endl;
os << "m_picturesCount" << ":" << obj.m_picturesCount << ", ";
os << "m_platesCount" << ":" << obj.m_platesCount << ", ";
os << "m_detectRate" << ":" << obj.m_detectRate << "%. " << std::endl;
os << "m_detectRecall" << ":" << obj.m_detectRecall << "%" << ", ";
os << "m_detectPrecise" << ":" << obj.m_detectPrecise << "%" << ", ";
os << "m_detectFscore" << ":" << obj.m_detectFscore << "%" << "." << endl;
os << "m_0error" << ":" << obj.m_0error << "%, ";
os << "m_1error" << ":" << obj.m_1error << "%, ";
os << "m_chinesePrecise" << ":" << obj.m_chinesePrecise << "%. " << endl;
os << "m_seconds" << ":" << obj.m_seconds << "sec" << ", ";
os << "m_avgSeconds" << ":" << obj.m_avgSeconds << "sec." << std::endl;
os << obj.m_params << std::endl;
return os;
}
private:
int m_picturesCount;
int m_platesCount;
float m_detectRate;
float m_detectRecall;
float m_detectPrecise;
float m_detectFscore;
float m_0error;
float m_1error;
float m_chinesePrecise;
float m_seconds;
float m_avgSeconds;
Params m_params;
};
} /*! \namespace demo*/
} /*! \namespace easypr*/
#endif // EASYPR_RESULT_HPP

@ -165,7 +165,9 @@
<ItemGroup>
<ClInclude Include="..\test\accuracy.hpp" />
<ClInclude Include="..\test\chars.hpp" />
<ClInclude Include="..\test\config.hpp" />
<ClInclude Include="..\test\plate.hpp" />
<ClInclude Include="..\test\result.hpp" />
<ClInclude Include="..\thirdparty\xmlParser\xmlParser.h" />
</ItemGroup>
<ItemGroup>

@ -35,6 +35,12 @@
<ClInclude Include="..\thirdparty\xmlParser\xmlParser.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\test\config.hpp">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\test\result.hpp">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="..\accuracy.txt" />

@ -151,6 +151,7 @@
<ClCompile Include="..\src\core\chars_segment.cpp" />
<ClCompile Include="..\src\core\core_func.cpp" />
<ClCompile Include="..\src\core\feature.cpp" />
<ClCompile Include="..\src\core\params.cpp" />
<ClCompile Include="..\src\core\plate_detect.cpp" />
<ClCompile Include="..\src\core\plate_judge.cpp" />
<ClCompile Include="..\src\core\plate_locate.cpp" />
@ -178,6 +179,7 @@
<ClInclude Include="..\include\easypr\core\chars_segment.h" />
<ClInclude Include="..\include\easypr\core\core_func.h" />
<ClInclude Include="..\include\easypr\core\feature.h" />
<ClInclude Include="..\include\easypr\core\params.h" />
<ClInclude Include="..\include\easypr\core\plate.hpp" />
<ClInclude Include="..\include\easypr\core\plate_detect.h" />
<ClInclude Include="..\include\easypr\core\plate_judge.h" />

@ -120,6 +120,9 @@
<ClCompile Include="..\thirdparty\LBP\lbp.cpp">
<Filter>源文件\thirdparty</Filter>
</ClCompile>
<ClCompile Include="..\src\core\params.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\easypr\preprocess\deface.h">
@ -200,6 +203,9 @@
<ClInclude Include="..\thirdparty\textDetect\erfilter.hpp">
<Filter>头文件\thirdparty</Filter>
</ClInclude>
<ClInclude Include="..\include\easypr\core\params.h">
<Filter>头文件\easypr\core</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE" />

Loading…
Cancel
Save