增加参数实体类

pull/37/head
lidapeng 5 years ago
parent cf9dbeca7a
commit c33b9dc86c

@ -30,13 +30,13 @@ public class Operation {//进行计算
public Operation(TempleConfig templeConfig) {
this.templeConfig = templeConfig;
dif = templeConfig.getShrink();
dif = templeConfig.getFood().getShrink();
}
public Operation(TempleConfig templeConfig, OutBack outBack) {
this.templeConfig = templeConfig;
this.outBack = outBack;
dif = templeConfig.getShrink();
dif = templeConfig.getFood().getShrink();
}
public List<Double> convolution(Matrix matrix, Map<Integer, Double> tagging) throws Exception {
@ -72,7 +72,7 @@ public class Operation {//进行计算
int ySize = maxY - minY;
ThreeChannelMatrix threeChannelMatrix1 = convolution.getRegionMatrix(threeChannelMatrix, minX, minY, xSize, ySize);
// convolution.filtering(threeChannelMatrix1);//光照过滤
int times = templeConfig.getTimes();
int times = templeConfig.getFood().getTimes();
for (int i = 0; i < times; i++) {
List<Double> feature = convolution.getCenterColor(threeChannelMatrix1, templeConfig.getPoolSize(),
templeConfig.getFeatureNub());

@ -19,6 +19,8 @@ import org.wlld.nerveCenter.NerveManager;
import org.wlld.nerveCenter.Normalization;
import org.wlld.nerveEntity.ModelParameter;
import org.wlld.nerveEntity.SensoryNerve;
import org.wlld.param.Cutting;
import org.wlld.param.Food;
import org.wlld.tools.ArithUtil;
import java.util.ArrayList;
@ -60,16 +62,17 @@ public class TempleConfig {
private int hiddenNerveNub = 9;//隐层神经元个数
private boolean isSoftMax = false;//是否启用softMax层
private int poolSize = 2;//池化尺寸
private int regionNub = 100;//一张图行或列分多少个区块
private double hTh = 0.88;//灰度阈值
private double maxRain = 340;//不降雨RGB阈值
private int featureNub = 4;//聚类特征数量
private Food food = new Food();
private Knn knn;//KNN分类器
private int knnNub = 7;//KNN投票人数
private int times = 10;//聚类循环次数
private int shrink = 60;//收缩参数
private ThreeChannelMatrix backGround;//背景面板
private double backGroundError;//背景误差偏移量0-255
private Cutting cutting = new Cutting();
public Cutting getCutting() {
return cutting;
}
public double getBackGroundError() {
return backGroundError;
@ -87,20 +90,8 @@ public class TempleConfig {
this.backGround = backGround;
}
public int getShrink() {
return shrink;
}
public void setShrink(int shrink) {
this.shrink = shrink;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
public Food getFood() {
return food;
}
public Knn getKnn() {
@ -123,30 +114,6 @@ public class TempleConfig {
this.featureNub = featureNub;
}
public double getMaxRain() {
return maxRain;
}
public void setMaxRain(double maxRain) {
this.maxRain = maxRain;
}
public int getRegionNub() {
return regionNub;
}
public void setRegionNub(int regionNub) {
this.regionNub = regionNub;
}
public double gethTh() {
return hTh;
}
public void sethTh(double hTh) {
this.hTh = hTh;
}
public int getPoolSize() {
return poolSize;
}

@ -3,6 +3,7 @@ package org.wlld.imageRecognition.segmentation;
import org.wlld.MatrixTools.Matrix;
import org.wlld.config.Kernel;
import org.wlld.imageRecognition.TempleConfig;
import org.wlld.param.Cutting;
import java.util.*;
@ -28,9 +29,10 @@ public class Watershed {
public Watershed(Matrix matrix, List<Specifications> specifications, TempleConfig templeConfig) throws Exception {
if (matrix != null && specifications != null && specifications.size() > 0) {
th = templeConfig.gethTh();
regionNub = templeConfig.getRegionNub();
maxRain = templeConfig.getMaxRain();
Cutting cutting = templeConfig.getCutting();
th = cutting.getTh();
regionNub = cutting.getRegionNub();
maxRain = cutting.getMaxRain();
this.matrix = matrix;
this.specifications = specifications;
xSize = matrix.getX() / regionNub;

@ -0,0 +1,37 @@
package org.wlld.param;
/**
* @param
* @DATA
* @Author LiDaPeng
* @Description
*/
public class Cutting {
private int regionNub = 200;//一张图行或列分多少个区块
private double th = 0.88;//灰度阈值
private double maxRain = 340;//不降雨RGB阈值
public int getRegionNub() {
return regionNub;
}
public void setRegionNub(int regionNub) {
this.regionNub = regionNub;
}
public double getTh() {
return th;
}
public void setTh(double th) {
this.th = th;
}
public double getMaxRain() {
return maxRain;
}
public void setMaxRain(double maxRain) {
this.maxRain = maxRain;
}
}

@ -0,0 +1,28 @@
package org.wlld.param;
/**
* @param
* @DATA
* @Author LiDaPeng
* @Description
*/
public class Food {
private int shrink = 60;//收缩参数
private int times = 10;//聚类增强次数
public int getShrink() {
return shrink;
}
public void setShrink(int shrink) {
this.shrink = shrink;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
}

@ -23,12 +23,8 @@ import java.util.Map;
*/
public class CoverTest {
public static void main(String[] args) throws Exception {
// double a = 220;
// double b = 220;
// double c = 220;
// double d = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) + Math.pow(c, 2));
// System.out.println(d);
cover();
//cover();
}
public static void insertModel(String model) throws Exception {//注入模型

@ -9,6 +9,8 @@ import org.wlld.imageRecognition.*;
import org.wlld.imageRecognition.segmentation.RegionBody;
import org.wlld.imageRecognition.segmentation.Specifications;
import org.wlld.nerveEntity.ModelParameter;
import org.wlld.param.Cutting;
import org.wlld.param.Food;
import org.wlld.tools.ArithUtil;
import java.util.ArrayList;
@ -18,7 +20,7 @@ public class FoodTest {
public static void main(String[] args) throws Exception {
//test2(null);
test();
//test();
}
public static void one(double[] test, double[] right, double[] wrong) {
@ -67,14 +69,21 @@ public class FoodTest {
public static TempleConfig getTemple() throws Exception {
TempleConfig templeConfig = new TempleConfig();
templeConfig.isShowLog(true);//是否打印日志
templeConfig.setMaxRain(320);//切割阈值
templeConfig.setFeatureNub(3);
templeConfig.sethTh(0.88);
Cutting cutting = templeConfig.getCutting();
Food food =templeConfig.getFood();
//切割
cutting.setMaxRain(320);//切割阈值
cutting.setTh(0.88);
cutting.setRegionNub(200);
//knn参数
templeConfig.setKnnNub(3);
templeConfig.setPoolSize(2);
templeConfig.setRegionNub(200);
templeConfig.setShrink(60);
templeConfig.setTimes(2);//聚类数据增强
//池化比例
templeConfig.setPoolSize(2);//缩小比例
//聚类
templeConfig.setFeatureNub(3);//聚类特征数量
//菜品识别实体类
food.setShrink(60);//缩紧像素
food.setTimes(2);//聚类数据增强
templeConfig.setClassifier(Classifier.KNN);
templeConfig.init(StudyPattern.Cover_Pattern, true, 400, 400, 3);
return templeConfig;

Loading…
Cancel
Save