|
|
|
@ -18,11 +18,36 @@ import com.yuxue.util.Convert;
|
|
|
|
|
*/
|
|
|
|
|
public class CharsIdentify {
|
|
|
|
|
|
|
|
|
|
private int predictSize = 10;
|
|
|
|
|
|
|
|
|
|
// 车牌不使用I及O字母,防止0,1混淆
|
|
|
|
|
private final char strCharacters[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
|
|
|
|
'F', 'G', 'H', /* 没有I */'J', 'K', 'L', 'M', 'N', /* 没有O */'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
|
|
|
|
|
'Z' };
|
|
|
|
|
|
|
|
|
|
private final String strChinese[] = { "zh_cuan" /* 川 */, "zh_e" /* 鄂 */, "zh_gan" /* 赣 */, "zh_gan1"/* 甘 */,
|
|
|
|
|
"zh_gui"/* 贵 */, "zh_gui1"/* 桂 */, "zh_hei" /* 黑 */, "zh_hu" /* 沪 */, "zh_ji" /* 冀 */, "zh_jin" /* 津 */,
|
|
|
|
|
"zh_jing" /* 京 */, "zh_jl" /* 吉 */, "zh_liao" /* 辽 */, "zh_lu" /* 鲁 */, "zh_meng" /* 蒙 */,
|
|
|
|
|
"zh_min" /* 闽 */, "zh_ning" /* 宁 */, "zh_qing" /* 青 */, "zh_qiong" /* 琼 */, "zh_shan" /* 陕 */,
|
|
|
|
|
"zh_su" /* 苏 */, "zh_sx" /* 晋 */, "zh_wan" /* 皖 */, "zh_xiang" /* 湘 */, "zh_xin" /* 新 */, "zh_yu" /* 豫 */,
|
|
|
|
|
"zh_yu1" /* 渝 */, "zh_yue" /* 粤 */, "zh_yun" /* 云 */, "zh_zang" /* 藏 */, "zh_zhe" /* 浙 */};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static int numCharacter = 34; // 没有I和0,10个数字与24个英文字符之和
|
|
|
|
|
|
|
|
|
|
private final static int numAll = 65; /* 34+31=65 */
|
|
|
|
|
|
|
|
|
|
private ANN_MLP ann=ANN_MLP.create();
|
|
|
|
|
|
|
|
|
|
private String path = "res/model/ann.xml";
|
|
|
|
|
|
|
|
|
|
static boolean hasPrint = false;
|
|
|
|
|
|
|
|
|
|
private Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CharsIdentify() {
|
|
|
|
|
loadModel(); // 加载ann配置文件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.map.isEmpty()) {
|
|
|
|
|
map.put("zh_cuan", "川");
|
|
|
|
|
map.put("zh_e", "鄂");
|
|
|
|
@ -57,8 +82,17 @@ public class CharsIdentify {
|
|
|
|
|
map.put("zh_zhe", "浙");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void loadModel() {
|
|
|
|
|
loadModel(this.path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void loadModel(String s) {
|
|
|
|
|
this.ann.clear();
|
|
|
|
|
ann=ANN_MLP.loadANN_MLP(s, "ann"); // 加载ann配置文件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param input
|
|
|
|
|
* @param isChinese
|
|
|
|
@ -102,22 +136,6 @@ public class CharsIdentify {
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ANN_MLP ann=ANN_MLP.create();
|
|
|
|
|
|
|
|
|
|
private String path = "res/model/ann.xml";
|
|
|
|
|
|
|
|
|
|
private void loadModel() {
|
|
|
|
|
loadModel(this.path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void loadModel(String s) {
|
|
|
|
|
this.ann.clear();
|
|
|
|
|
ann=ANN_MLP.loadANN_MLP(s, "ann");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static boolean hasPrint = false;
|
|
|
|
|
|
|
|
|
|
public final void setModelPath(String path) {
|
|
|
|
|
this.path = path;
|
|
|
|
@ -128,26 +146,5 @@ public class CharsIdentify {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int predictSize = 10;
|
|
|
|
|
|
|
|
|
|
// 车牌不使用I及O字母,防止0,1混淆
|
|
|
|
|
private final char strCharacters[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
|
|
|
|
'F', 'G', 'H', /* 没有I */'J', 'K', 'L', 'M', 'N', /* 没有O */'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
|
|
|
|
|
'Z' };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final String strChinese[] = { "zh_cuan" /* 川 */, "zh_e" /* 鄂 */, "zh_gan" /* 赣 */, "zh_gan1"/* 甘 */,
|
|
|
|
|
"zh_gui"/* 贵 */, "zh_gui1"/* 桂 */, "zh_hei" /* 黑 */, "zh_hu" /* 沪 */, "zh_ji" /* 冀 */, "zh_jin" /* 津 */,
|
|
|
|
|
"zh_jing" /* 京 */, "zh_jl" /* 吉 */, "zh_liao" /* 辽 */, "zh_lu" /* 鲁 */, "zh_meng" /* 蒙 */,
|
|
|
|
|
"zh_min" /* 闽 */, "zh_ning" /* 宁 */, "zh_qing" /* 青 */, "zh_qiong" /* 琼 */, "zh_shan" /* 陕 */,
|
|
|
|
|
"zh_su" /* 苏 */, "zh_sx" /* 晋 */, "zh_wan" /* 皖 */, "zh_xiang" /* 湘 */, "zh_xin" /* 新 */, "zh_yu" /* 豫 */,
|
|
|
|
|
"zh_yu1" /* 渝 */, "zh_yue" /* 粤 */, "zh_yun" /* 云 */, "zh_zang" /* 藏 */, "zh_zhe" /* 浙 */};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static int numCharacter = 34; // 没有I和0,10个数字与24个英文字符之和
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private final static int numChinese = 31;
|
|
|
|
|
|
|
|
|
|
private final static int numAll = 65; /* 34+31=65 */
|
|
|
|
|
}
|
|
|
|
|