diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0b8a0b0..09edd87 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,9 @@ + + @@ -21,11 +23,23 @@ - + - - + + + + + + + + + + + + + + @@ -69,9 +83,9 @@ @@ -168,7 +182,7 @@ - + @@ -297,34 +311,34 @@ - + - + - + - + - + - + - + - + - + - + @@ -332,7 +346,7 @@ - + @@ -341,7 +355,7 @@ - + @@ -369,54 +383,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -431,12 +397,20 @@ - + - - + + + + + + + + + + @@ -450,8 +424,18 @@ - - + + + + + + + + + + + + diff --git a/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/InferenceProcessor.java b/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/InferenceProcessor.java index 2a4c899..6d1e9f6 100644 --- a/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/InferenceProcessor.java +++ b/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/InferenceProcessor.java @@ -147,25 +147,22 @@ public void process(final InputStream input, final java.io.OutputStream out) thr for (Result result : results) { attributes.put(String.format("label_%d", i), result.getLabel() ); attributes.put(String.format("probability_%d",i), String.format("%.2f", result.getProbability())); - - if ( result.getXmin() > 0) { - attributes.put(String.format("xmin_%d", i), String.format("%.2f", result.getXmin())); - attributes.put(String.format("xmax_%d", i), String.format("%.2f", result.getXmax())); - attributes.put(String.format("ymin_%d", i), String.format("%.2f", result.getYmin())); - attributes.put(String.format("ymax_%d", i), String.format("%.2f", result.getYmax())); - attributes.put(String.format("height_%d", i), String.format("%d", result.getHeight())); - attributes.put(String.format("width_%d", i), String.format("%d", result.getWidth())); - } + attributes.put(String.format("xmin_%d", i), String.format("%.2f", result.getXmin())); + attributes.put(String.format("xmax_%d", i), String.format("%.2f", result.getXmax())); + attributes.put(String.format("ymin_%d", i), String.format("%.2f", result.getYmin())); + attributes.put(String.format("ymax_%d", i), String.format("%.2f", result.getYmax())); + attributes.put(String.format("height_%d", i), String.format("%d", result.getHeight())); + attributes.put(String.format("width_%d", i), String.format("%d", result.getWidth())); Graphics2D g2d = (Graphics2D) img.createGraphics(); try { - // Draw on the buffered image + // Draw on the buffered image with our rectangles g2d.setStroke(new BasicStroke(3)); - g2d.setColor(Color.GREEN); - g2d.drawRect(Math.round(result.getXmin()), Math.round(result.getYmin()), - Math.round(result.getWidth()), - Math.round(result.getHeight())); + g2d.setColor(Color.BLUE); + g2d.drawRect((int)(result.getXmin()), (int)(result.getYmin()), + (int)(result.getXmax()), + (int)(result.getYmax())); g2d.dispose(); } catch (Exception e) { diff --git a/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/SSDClassifierService.java b/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/SSDClassifierService.java index 84da2a8..c9e1f13 100644 --- a/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/SSDClassifierService.java +++ b/nifi-mxnetinference-processors/src/main/java/com/dataflowdeveloper/mxnet/SSDClassifierService.java @@ -137,13 +137,13 @@ public List ssdClassify(String modelPath, byte[] imageBytes) { for (ObjectDetectorOutput i : ele) { if ( i != null ) { Result result = new Result(); - + result.setLabel(i.getClassName()); result.setProbability(i.getProbability()); - result.setXmin(i.getXMin() * width); - result.setXmax(i.getXMax() * height); - result.setYmin(i.getYMin() * width); - result.setYmax(i.getYMax() * height); + result.setXmin(i.getXMin() * width ); // + result.setXmax(i.getXMax() * width ); // + result.setYmin(i.getYMin() * height ); // + result.setYmax(i.getYMax() * height ); // result.setWidth(width); result.setHeight(height); result.setRank(rank); diff --git a/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor$1.class b/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor$1.class index e62e858..f0b5bc6 100644 Binary files a/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor$1.class and b/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor$1.class differ diff --git a/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor.class b/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor.class index 2a86c29..8bd5d65 100644 Binary files a/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor.class and b/nifi-mxnetinference-processors/target/classes/com/dataflowdeveloper/mxnet/InferenceProcessor.class differ