Loading src/main/java/object_detection/ObjectDetector.java +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class ObjectDetector { // printing final object set for sanity System.out.println(objSet); System.out.println("====> Finished Object Mapping"); } /** Loading src/main/java/object_detection/types/ObjectSet.java +13 −22 Original line number Diff line number Diff line Loading @@ -42,24 +42,21 @@ public class ObjectSet { Point[] r1 = this.objects.get(i).getPoints(); Point[] r2 = this.objects.get(j).getPoints(); // O(n) Set<Point> s = new HashSet<>(); for(Point r : r1){ if(r != null){ s.add(r); } } // O(n) int count = 0; for(Point p : r2){ if(p!=null && s.contains(p)){ // O(n^2) for (Point point : r1) { for (Point value : r2) { if (point.equals(value)) { // we found point r1[x], now find next, and so on count++; break; } } } // in this line, if the reps are 80% similar, assume this is the same set. return (count) > (r1.length*0.8); // in this line, if the reps are 20% similar, assume this is the same set. return (count) > (Math.max(r1.length, r2.length)*0.1); } /** Loading Loading @@ -88,7 +85,7 @@ public class ObjectSet { public List<ArrayList<Point>> processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // Print the name of the file being processed System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName()); //System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName()); // Read bounding boxes List<BoundingBox> boundingBoxes = readBoundingBoxes(bboxCsv); Loading Loading @@ -145,7 +142,6 @@ public class ObjectSet { continue; } if (compareObjects(objIdx, j)) { System.out.println("COMBINING"); combineObjects(j, objIdx); break; } Loading Loading @@ -188,11 +184,6 @@ public class ObjectSet { */ @Override public String toString(){ StringBuilder res = new StringBuilder("ObjectSet:"); for(PointSet p : this.objects){ res.append("\n\t - Object with ").append(p.pset.size()).append(" points"); } return res.toString(); return "ObjectSet of : " + this.objects.size() + " objects"; } } No newline at end of file src/main/java/object_detection/types/Point.java +2 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ public class Point { * @return true if points are close enough */ public static boolean equals(Point aa, Point bb, float err){ return (aa.x - bb.x < err) && (aa.y - bb.y < err) && (aa.z - bb.z < err); return (Math.abs(aa.x - bb.x) < err) && (Math.abs(aa.y - bb.y) < err) && (Math.abs(aa.z - bb.z) < err); } @Override Loading @@ -40,7 +40,7 @@ public class Point { return false; } Point p = (Point) o; return Point.equals(this, p, (float) 0.05); return Point.equals(this, p, (float) 2); } @Override Loading target/classes/object_detection/ObjectDetector.class +47 B (2.38 KiB) File changed.No diff preview for this file type. View original file View changed file target/classes/object_detection/types/ObjectSet.class −724 B (5.6 KiB) File changed.No diff preview for this file type. View original file View changed file Loading
src/main/java/object_detection/ObjectDetector.java +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class ObjectDetector { // printing final object set for sanity System.out.println(objSet); System.out.println("====> Finished Object Mapping"); } /** Loading
src/main/java/object_detection/types/ObjectSet.java +13 −22 Original line number Diff line number Diff line Loading @@ -42,24 +42,21 @@ public class ObjectSet { Point[] r1 = this.objects.get(i).getPoints(); Point[] r2 = this.objects.get(j).getPoints(); // O(n) Set<Point> s = new HashSet<>(); for(Point r : r1){ if(r != null){ s.add(r); } } // O(n) int count = 0; for(Point p : r2){ if(p!=null && s.contains(p)){ // O(n^2) for (Point point : r1) { for (Point value : r2) { if (point.equals(value)) { // we found point r1[x], now find next, and so on count++; break; } } } // in this line, if the reps are 80% similar, assume this is the same set. return (count) > (r1.length*0.8); // in this line, if the reps are 20% similar, assume this is the same set. return (count) > (Math.max(r1.length, r2.length)*0.1); } /** Loading Loading @@ -88,7 +85,7 @@ public class ObjectSet { public List<ArrayList<Point>> processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // Print the name of the file being processed System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName()); //System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName()); // Read bounding boxes List<BoundingBox> boundingBoxes = readBoundingBoxes(bboxCsv); Loading Loading @@ -145,7 +142,6 @@ public class ObjectSet { continue; } if (compareObjects(objIdx, j)) { System.out.println("COMBINING"); combineObjects(j, objIdx); break; } Loading Loading @@ -188,11 +184,6 @@ public class ObjectSet { */ @Override public String toString(){ StringBuilder res = new StringBuilder("ObjectSet:"); for(PointSet p : this.objects){ res.append("\n\t - Object with ").append(p.pset.size()).append(" points"); } return res.toString(); return "ObjectSet of : " + this.objects.size() + " objects"; } } No newline at end of file
src/main/java/object_detection/types/Point.java +2 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ public class Point { * @return true if points are close enough */ public static boolean equals(Point aa, Point bb, float err){ return (aa.x - bb.x < err) && (aa.y - bb.y < err) && (aa.z - bb.z < err); return (Math.abs(aa.x - bb.x) < err) && (Math.abs(aa.y - bb.y) < err) && (Math.abs(aa.z - bb.z) < err); } @Override Loading @@ -40,7 +40,7 @@ public class Point { return false; } Point p = (Point) o; return Point.equals(this, p, (float) 0.05); return Point.equals(this, p, (float) 2); } @Override Loading
target/classes/object_detection/ObjectDetector.class +47 B (2.38 KiB) File changed.No diff preview for this file type. View original file View changed file
target/classes/object_detection/types/ObjectSet.class −724 B (5.6 KiB) File changed.No diff preview for this file type. View original file View changed file