|
|
@ -36,25 +36,30 @@ public class App {
|
|
|
|
//设置图像行列比例的列,默认为3 选填
|
|
|
|
//设置图像行列比例的列,默认为3 选填
|
|
|
|
templeConfig.setColumn(3);
|
|
|
|
templeConfig.setColumn(3);
|
|
|
|
//对模版进行初始化 Ps:初始化一定要在所有参数设置完成后设置,否则设置无效。
|
|
|
|
//对模版进行初始化 Ps:初始化一定要在所有参数设置完成后设置,否则设置无效。
|
|
|
|
// 使用默认值(模型参数注入除外)
|
|
|
|
// 使用默认值(模型参数注入除外)若无需注入参数 选择TRU,若注入模型参数选择FALSE
|
|
|
|
|
|
|
|
//相似说明见 文档1
|
|
|
|
templeConfig.initNerveManager(true);//对模板初始化
|
|
|
|
templeConfig.initNerveManager(true);//对模板初始化
|
|
|
|
//初始化计算类
|
|
|
|
//初始化计算类
|
|
|
|
Operation operation = new Operation(templeConfig);
|
|
|
|
Operation operation = new Operation(templeConfig);
|
|
|
|
//初始化模板标注
|
|
|
|
//标注主键为 第几种分类,值为标注 1 是TRUE 0是FALSE
|
|
|
|
Map<Integer, Double> rightTagging = new HashMap<>();//分类标注
|
|
|
|
Map<Integer, Double> rightTagging = new HashMap<>();//分类标注
|
|
|
|
Map<Integer, Double> wrongTagging = new HashMap<>();//分类标注
|
|
|
|
Map<Integer, Double> wrongTagging = new HashMap<>();//分类标注
|
|
|
|
rightTagging.put(1, 1.0);
|
|
|
|
rightTagging.put(1, 1.0);
|
|
|
|
wrongTagging.put(1, 0.0);
|
|
|
|
wrongTagging.put(1, 0.0);
|
|
|
|
for (int i = 1; i < 999; i++) {
|
|
|
|
for (int i = 1; i < 999; i++) {
|
|
|
|
System.out.println("开始学习1==" + i);
|
|
|
|
System.out.println("开始学习1==" + i);
|
|
|
|
|
|
|
|
//读取本地URL地址图片,并转化成矩阵
|
|
|
|
Matrix right = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/c/c" + i + ".png");
|
|
|
|
Matrix right = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/c/c" + i + ".png");
|
|
|
|
Matrix wrong = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/b/b" + i + ".png");
|
|
|
|
Matrix wrong = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/b/b" + i + ".png");
|
|
|
|
|
|
|
|
//将图像矩阵和标注加入进行学习,
|
|
|
|
operation.study(right, rightTagging);
|
|
|
|
operation.study(right, rightTagging);
|
|
|
|
operation.study(wrong, wrongTagging);
|
|
|
|
operation.study(wrong, wrongTagging);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matrix right = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/c/c1000.png");
|
|
|
|
Matrix right = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/c/c1000.png");
|
|
|
|
Matrix wrong = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/b/b1000.png");
|
|
|
|
Matrix wrong = picture.getImageMatrixByLocal("/Users/lidapeng/Desktop/myDocment/b/b1000.png");
|
|
|
|
ma.setNub(1);
|
|
|
|
ma.setNub(1);
|
|
|
|
|
|
|
|
//进行图像检测
|
|
|
|
operation.look(right, 2);
|
|
|
|
operation.look(right, 2);
|
|
|
|
ma.setNub(2);
|
|
|
|
ma.setNub(2);
|
|
|
|
operation.look(wrong, 3);
|
|
|
|
operation.look(wrong, 3);
|
|
|
|