图片 HOG 相关性
问题:
Key: Faces_0001.jpg: Value: 1:1:1:0:0:0:0:0:0:1
Key: Faces_0002.jpg: Value: 0:0:0:1:3:4:0:0:0:0Key: Faces_0003.jpg: Value: 0:0:0:0:0:0:2:3:1:0
Key: Faces_0004.jpg: Value: 1:1:0:1:0:0:0:0:0:0
Key: Faces_0005.jpg: Value: 0:0:0:2:2:0:1:0:0:0
Key: Faces_0006.jpg: Value: 0:1:0:2:0:0:1:0:0:0
相关性【并按照图片Faces_0001.jpg的特征比率比如第一个直方图的比率为0.25.第二个直方图0.25,第三个0.25,第十个0.25但是和图片Faces_0004.jpg有两个相似就是0.5
与Faces_0006.jpg就只占0.25,就按大小排序从Faces_0004.jpg Faces_0006.jpg....来输出】
实现第一步:
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.text.DecimalFormat;
- import java.util.ArrayList;
- import java.util.TreeMap;
- public class connecttion_of_Accuracy {
- /*
- * ********** 实现关系(对应):一个属性:图片1-所占比率 - -图片2-所占比率***********
- */
- public static String normalization(String[] a, int m) {
- String b;
- int sum = 0;
- for (int j = 3; j < a.length; j++) {
- // 一定记住j不能为0,因为其前面几个值是字符串
- sum += Integer.parseInt(a[j]);
- }
- // System.out.println(sum);
- int k = Integer.parseInt(a[m]);
- DecimalFormat df2 = new DecimalFormat("0.00000");
- b = df2.format((double) k / sum);
- return b;
- }
- public static void main(String[] args) throws Exception {
- String a = "0";
- BufferedReader reader = new BufferedReader(new FileReader(
- "D:\\0325.txt"));// 待求精度的分类结果
- String line = reader.readLine();
- while (line != null) {
- String[] list = null;
- String t1 = line.replace(" ", "");
- list = t1.split(":");
- // float accuracy1= 0;
- TreeMap<String, Integer> map = new TreeMap<String, Integer>();
- for (int i = 3; i < list.length; i++