* fix #184, fix #174, fix#158: the kv load etc file, no respones bug

* fix #194, move resources/model to model,  move etc to resources/text
* fix #191, new chinese gray train.
v1.6alpha
liuruoze 9 years ago
parent 1636e8cb4e
commit fe366e542f

@ -6,19 +6,12 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/opencv3")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/opencv-3.1.0")
endif ()
# OpenVC3 required
find_package(OpenCV 3.1.0 REQUIRED)
# optional OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# where to find header files
include_directories(.)
include_directories(include)
@ -41,12 +34,10 @@ set(SOURCE_FILES
src/core/params.cpp
src/train/ann_train.cpp
src/train/annCh_train.cpp
src/train/svm_train.cpp
src/train/train.cpp
src/preprocess/deface.cpp
src/preprocess/gdts.cpp
src/preprocess/mc_data.cpp
src/train/create_data.cpp
src/util/util.cpp
src/util/program_options.cpp
@ -57,12 +48,17 @@ set(SOURCE_FILES
add_library(easypr STATIC ${SOURCE_FILES})
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(EXECUTABLE_NAME "demo_darwin_amd64")
set(EXECUTABLE_NAME "demo")
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(EXECUTABLE_NAME "demo_linux_amd64")
set(EXECUTABLE_NAME "demo")
endif ()
# set to be releas mode
# set(CMAKE_BUILD_TYPE Release)
# test cases
add_executable(${EXECUTABLE_NAME} test/main.cpp)
# link opencv libs
target_link_libraries(${EXECUTABLE_NAME} easypr thirdparty ${OpenCV_LIBS})
target_link_libraries(${EXECUTABLE_NAME} easypr thirdparty ${OpenCV_LIBS})
# MESSAGE(${CMAKE_BINARY_DIR}/../)
SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../")

@ -148,12 +148,12 @@ EasyPR的resources/image/general_test文件夹下的图片数据遵循[GDSL协
| src | 所有源文件
| include | 所有头文件
| test | 测试程序
| etc | 中文字符映射表
| resources/model | 机器学习的模型
| model | 机器学习的模型
| resources/text | 中文字符映射表
| resources/train | 训练数据与说明
| resources/image | 测试用的图片
| resources/doc | 相关文档
| tmp | 需要自建,训练数据读取目录
| tmp | 训练数据读取目录,需要自建
以下表格是resources/image目录中子目录的解释:
@ -161,7 +161,7 @@ EasyPR的resources/image/general_test文件夹下的图片数据遵循[GDSL协
|------|----------
| general_test | GDTS通用数据测试集
| native_test | NDTS本地数据测试集
| tmp | Debug模式下EasyPR输出中间图片的目录
| tmp | Debug模式下EasyPR输出中间图片的目录,需要自建
以下表格是src目录中子目录的解释:

@ -26,13 +26,16 @@ namespace easypr {
PR_DETECT_CMSER = 0x04, /**Character detect type, using mser */
};
static const char* kDefaultSvmPath = "resources/model/svm_hist.xml";
static const char* kLBPSvmPath = "resources/model/svm_lbp.xml";
static const char* kHistSvmPath = "resources/model/svm_hist.xml";
static const char* kDefaultSvmPath = "model/svm_hist.xml";
static const char* kLBPSvmPath = "model/svm_lbp.xml";
static const char* kHistSvmPath = "model/svm_hist.xml";
static const char* kDefaultAnnPath = "resources/model/ann.xml";
static const char* kChineseAnnPath = "resources/model/ann_chinese.xml";
static const char* kGrayAnnPath = "resources/model/annCh.xml";
static const char* kDefaultAnnPath = "model/ann.xml";
static const char* kChineseAnnPath = "model/ann_chinese.xml";
static const char* kGrayAnnPath = "model/annCh.xml";
//This is important to for key transform to chinese
static const char* kChineseMappingPath = "model/province_mapping";
typedef enum {
kForward = 1, // correspond to "has plate"

@ -33,15 +33,24 @@ public:
void LoadModel(std::string path);
void LoadChineseModel(std::string path);
void LoadGrayModel(std::string path);
void LoadGrayChANN(std::string path);
void LoadChineseMapping(std::string path);
private:
CharsIdentify();
annCallback extractFeature;
static CharsIdentify* instance_;
// binary character classifer
cv::Ptr<cv::ml::ANN_MLP> ann_;
// binary character classifer, only for chinese
cv::Ptr<cv::ml::ANN_MLP> annChinese_;
// gray classifer, only for chinese
cv::Ptr<cv::ml::ANN_MLP> annGray_;
// used for chinese mapping
std::shared_ptr<Kv> kv_;
};
}

@ -39,6 +39,10 @@ namespace easypr {
void LoadANN(std::string path);
void LoadChineseANN(std::string path);
//v1.6 added
void LoadGrayChANN(std::string path);
void LoadChineseMapping(std::string path);
private:
// show the detect and recognition result image
bool m_showResult;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,31 @@
zh_cuan 川
zh_gan1 甘
zh_hei 黑
zh_jin 津
zh_liao 辽
zh_min 闽
zh_qiong 琼
zh_sx 晋
zh_xin 新
zh_yue 粤
zh_zhe 浙
zh_e 鄂
zh_gui 贵
zh_hu 沪
zh_jing 京
zh_lu 鲁
zh_ning 宁
zh_shan 陕
zh_wan 皖
zh_yu 豫
zh_yun 云
zh_gan 赣
zh_gui1 桂
zh_ji 冀
zh_jl 吉
zh_meng 蒙
zh_qing 青
zh_su 苏
zh_xiang 湘
zh_yu1 渝
zh_zang 藏

@ -3,5 +3,5 @@
(贡献包括有益建议,代码调优,数据提供等等,排名按时间顺序)
taotao1233邱锦山唐大侠jsxyhelu如果有一天(zhoushiwei)
学习奋斗袁承志圣城小石匠goldriverMicooz梦里时光
Rain Wangahccoms星夜落尘海豚嘎嘎
Rain Wangahccoms星夜落尘海豚嘎嘎, Free大神等等
还有很多的同学对本项目也给予了鼓励与支持,在此也一并表示真诚的谢意!

File diff suppressed because it is too large Load Diff

@ -3248,3 +3248,18 @@ Recall:85.1281%, Precise:80.5653%, Fscore:82.7839%.
Recall:85.1281%, Precise:80.5653%, Fscore:82.7839%.
0-error:70.6122%, 1-error:82.8571%, Chinese-precise:86.5306%
总共时间: 150秒, 平均执行时间:0.585938秒
2017-04-30 16:38:57
总图片数:256, Plates count:297, 未定位车牌:23, 检出率:92.2559%
Recall:85.1281%, Precise:80.5653%, Fscore:82.7839%.
0-error:70.6122%, 1-error:82.8571%, Chinese-precise:86.5306%
总共时间: 157秒, 平均执行时间:0.613281秒
2017-04-30 17:14:08
总图片数:256, Plates count:297, 未定位车牌:23, 检出率:92.2559%
Recall:85.1281%, Precise:80.5653%, Fscore:82.7839%.
0-error:70.6122%, 1-error:82.8571%, Chinese-precise:86.5306%
总共时间: 166秒, 平均执行时间:0.648438秒
2017-04-30 17:29:47
总图片数:256, Plates count:297, 未定位车牌:23, 检出率:92.2559%
Recall:85.1281%, Precise:80.5653%, Fscore:82.7839%.
0-error:70.6122%, 1-error:82.8571%, Chinese-precise:86.5306%
总共时间: 159秒, 平均执行时间:0.621094秒

File diff suppressed because it is too large Load Diff

@ -22,8 +22,9 @@ CharsIdentify::CharsIdentify() {
LOAD_ANN_MODEL(ann_, kDefaultAnnPath);
LOAD_ANN_MODEL(annChinese_, kChineseAnnPath);
LOAD_ANN_MODEL(annGray_, kGrayAnnPath);
kv_ = std::shared_ptr<Kv>(new Kv);
kv_->load("etc/province_mapping");
kv_->load(kChineseMappingPath);
extractFeature = getGrayPlusProject;
}
@ -44,7 +45,7 @@ void CharsIdentify::LoadChineseModel(std::string path) {
}
}
void CharsIdentify::LoadGrayModel(std::string path) {
void CharsIdentify::LoadGrayChANN(std::string path) {
if (path != std::string(kGrayAnnPath)) {
if (!annGray_->empty())
annGray_->clear();
@ -52,6 +53,11 @@ void CharsIdentify::LoadGrayModel(std::string path) {
}
}
void CharsIdentify::LoadChineseMapping(std::string path) {
kv_->clear();
kv_->load(path);
}
void CharsIdentify::classify(cv::Mat featureRows, std::vector<int>& out_maxIndexs,
std::vector<float>& out_maxVals, std::vector<bool> isChineseVec){
int rowNum = featureRows.rows;

@ -83,6 +83,14 @@ void CPlateRecognize::LoadChineseANN(std::string path) {
CharsIdentify::instance()->LoadChineseModel(path);
}
void CPlateRecognize::LoadGrayChANN(std::string path) {
CharsIdentify::instance()->LoadGrayChANN(path);
}
void CPlateRecognize::LoadChineseMapping(std::string path) {
CharsIdentify::instance()->LoadChineseMapping(path);
}
// deprected
int CPlateRecognize::plateRecognize(const Mat& src, std::vector<std::string> &licenseVec) {
vector<CPlate> plates;

@ -17,7 +17,7 @@ namespace easypr {
ann_ = cv::ml::ANN_MLP::create();
type = 1;
kv_ = std::shared_ptr<Kv>(new Kv);
kv_->load("etc/province_mapping");
kv_->load("resources/text/province_mapping");
extractFeature = getGrayPlusProject;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save