|
|
|
@ -52,15 +52,15 @@ public class CoverTest {
|
|
|
|
|
return new Operation(templeConfig);//初始化运算类
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void test(Operation operation, int poolSize, int sqlNub, int regionSize,
|
|
|
|
|
public static void test(Operation operation, int sqlNub, int regionSize,
|
|
|
|
|
String name, int t) throws Exception {
|
|
|
|
|
Picture picture = new Picture();
|
|
|
|
|
int wrong = 0;
|
|
|
|
|
if (operation == null) {
|
|
|
|
|
operation = getModel();
|
|
|
|
|
}
|
|
|
|
|
for (int i = 1; i < 100; i++) {
|
|
|
|
|
String na = "D:\\share\\cai/" + name + i + ".jpg";
|
|
|
|
|
for (int i = 1; i < 20; i++) {
|
|
|
|
|
String na = "/Users/lidapeng/Desktop/myDocument/food/" + name + i + ".jpg";
|
|
|
|
|
//System.out.println("name======================" + na);
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix = picture.getThreeMatrix(na);
|
|
|
|
|
Map<Integer, Double> map1 = operation.coverPoint(threeChannelMatrix, sqlNub, regionSize);
|
|
|
|
@ -90,6 +90,8 @@ public class CoverTest {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void cover() throws Exception {
|
|
|
|
|
int sqNub = 1;
|
|
|
|
|
int regionSize = 20;
|
|
|
|
|
//创建图片解析类 桔梗覆盖,桔梗焚烧,土壤扰动
|
|
|
|
|
Picture picture = new Picture();
|
|
|
|
|
//创建模版类,参数选false就可以
|
|
|
|
@ -97,35 +99,36 @@ public class CoverTest {
|
|
|
|
|
//初始化模板 注意 width height参数是你训练图片的实际尺寸需要改,其他不用动
|
|
|
|
|
//创建运算类进行标注
|
|
|
|
|
templeConfig.isShowLog(true);
|
|
|
|
|
templeConfig.setStudyPoint(0.01);//不动
|
|
|
|
|
templeConfig.setSoftMax(true);
|
|
|
|
|
//templeConfig.setDeep(2);
|
|
|
|
|
//templeConfig.setHiddenNerveNub(9);
|
|
|
|
|
templeConfig.setSensoryNerveNub(3);//多出来的
|
|
|
|
|
templeConfig.setStudyPoint(0.005);//不动
|
|
|
|
|
//templeConfig.setSoftMax(true);
|
|
|
|
|
templeConfig.setDeep(2);
|
|
|
|
|
templeConfig.setHiddenNerveNub(9);
|
|
|
|
|
templeConfig.setSensoryNerveNub(sqNub);//多出来的
|
|
|
|
|
templeConfig.setRzType(RZ.L1);//不动//3 18
|
|
|
|
|
templeConfig.setlParam(0.015);//不动
|
|
|
|
|
templeConfig.setClassifier(Classifier.DNN);
|
|
|
|
|
templeConfig.init(StudyPattern.Cover_Pattern, true, 400, 400, 4);
|
|
|
|
|
Operation operation = new Operation(templeConfig);
|
|
|
|
|
for (int i = 1; i < 100; i++) {
|
|
|
|
|
for (int i = 1; i < 20; i++) {
|
|
|
|
|
System.out.println("i====================================" + i);
|
|
|
|
|
Map<Integer, ThreeChannelMatrix> matrixMap = new HashMap<>();
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix1 = picture.getThreeMatrix("D:\\share\\cai/a" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix2 = picture.getThreeMatrix("D:\\share\\cai/b" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix3 = picture.getThreeMatrix("D:\\share\\cai/c" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix4 = picture.getThreeMatrix("D:\\share\\cai/d" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix1 = picture.getThreeMatrix("/Users/lidapeng/Desktop/myDocument/food/a" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix2 = picture.getThreeMatrix("/Users/lidapeng/Desktop/myDocument/food/b" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix3 = picture.getThreeMatrix("/Users/lidapeng/Desktop/myDocument/food/c" + i + ".jpg");
|
|
|
|
|
ThreeChannelMatrix threeChannelMatrix4 = picture.getThreeMatrix("/Users/lidapeng/Desktop/myDocument/food/d" + i + ".jpg");
|
|
|
|
|
matrixMap.put(1, threeChannelMatrix1);//桔梗覆盖
|
|
|
|
|
matrixMap.put(2, threeChannelMatrix2);//土地
|
|
|
|
|
matrixMap.put(3, threeChannelMatrix3);//桔梗覆盖
|
|
|
|
|
matrixMap.put(4, threeChannelMatrix4);//土地
|
|
|
|
|
operation.coverStudy(matrixMap, 2, 18);
|
|
|
|
|
operation.coverStudy(matrixMap, sqNub, regionSize);
|
|
|
|
|
}
|
|
|
|
|
ModelParameter modelParameter = templeConfig.getModel();
|
|
|
|
|
String model = JSON.toJSONString(modelParameter);
|
|
|
|
|
System.out.println(model);
|
|
|
|
|
test(operation, 2, 3, 18, "a", 1);
|
|
|
|
|
test(operation, 2, 3, 18, "b", 2);
|
|
|
|
|
test(operation, 2, 3, 18, "c", 3);
|
|
|
|
|
test(operation, 2, 3, 18, "d", 4);
|
|
|
|
|
// ModelParameter modelParameter = templeConfig.getModel();
|
|
|
|
|
// String model = JSON.toJSONString(modelParameter);
|
|
|
|
|
// System.out.println(model);
|
|
|
|
|
test(operation, sqNub, regionSize, "a", 1);
|
|
|
|
|
test(operation, sqNub, regionSize, "b", 2);
|
|
|
|
|
test(operation, sqNub, regionSize, "c", 3);
|
|
|
|
|
test(operation, sqNub, regionSize, "d", 4);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|