From 09f7cfedd801f4c848a358ca7f6fe8d71628a1ac Mon Sep 17 00:00:00 2001 From: Timothy Spann Date: Wed, 5 Dec 2018 16:12:07 -0500 Subject: [PATCH] fix --- .idea/workspace.xml | 124 ++++++++---------- .../mxnet/InferenceProcessor.java | 25 ++-- .../mxnet/SSDClassifierService.java | 10 +- .../mxnet/InferenceProcessor$1.class | Bin 4813 -> 4737 bytes .../mxnet/InferenceProcessor.class | Bin 7665 -> 7665 bytes 5 files changed, 70 insertions(+), 89 deletions(-) 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 e62e858d66f1ea9dd7c934bff22753b9ee41ab77..f0b5bc61c18a5a55e961a40744795194f38d3823 100644 GIT binary patch delta 1356 zcmZvcd2|#-5XOJq*-cMoJ0W1?u}^#g8ual56_sEDk`TEMQ3OOykPsk?fgmh$h^{Dj zfr^fDii+GQCx0seFLO?~zCS5wnnRkOQtr{$)09@(-D zxPYS>6fn-2@y;ZDJSO-Ry7|HF1 zJA4{)r_Wv7ZJ6nk!z`!V6C=UB&fI61?Qy@KBF+Oo0S|gSrJR?Bm2vlP+U(vgcT zohY;vQ)_tM@&YefUSfN&InuuHWy=m;F}!Mdjh%+qEpM>PvYR&zZ&}{v9m~6HS7djs znlPrkS#Ei=al^+?s7#KxyvLs4ylC@SG4C5buzbizK}od9$sbc|*~=%EPx;L9IbSGR z1Vy@OusnKF>Px;dd~NxLZxvZ%$5oXLElX4;l9PwzmMbE;ZQ72oe8)b+_il4PD9ohM zi7}#Deq>)rhfWIV{*X>Sq5gE79#?;MG^1j8Vq`@!%&lFDCcm&p;Z01GCo94vzp}^j z8@~tr(&MKU^M~aC2MvE({^D;-9sgMBIb=CZZ7@6i)Cm7_qvzCEVe+UZfX;z*mgX>`%qo5&xu zj;IXf^(4tr^}4OjCojYvvX^{aq#gFqy&Mw3oouzHRZy4REj33qVy^1MJXOhjHJ=4) z2Mg5!7O8p`YxziYHcNCfmg<%))2+mB&2rtAH9C*A@}iZx1FLkA@UFsp2=-^a9!Rww z%m!UXO<24sSotT2(ucly@`Up)C8p|ATth!Dldo-o+REkhCxa3l5+I>OD0WJmr_D0X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