Source:
<code>public List<DetectedObject> getPredictedObjects(INDArray networkOutput, double threshold){ if(networkOutput.rank() != 4){ throw new IllegalStateException("Invalid network output activations array: should be rank 4. Got array " + "with shape " + Arrays.toString(networkOutput.shape())); } if(threshold < 0.0 || threshold > 1.0){ throw new IllegalStateException("Invalid threshold: must be in range [0,1]. Got: " + threshold); } int mb = networkOutput.size(0); int h = networkOutput.size(2); int w = networkOutput.size(3); int b = layerConf().getBoundingBoxes().size(0); int c = (networkOutput.size(1)/b)-5; INDArray output5 = networkOutput.dup('c').reshape(mb, b, 5+c, h, w); INDArray predictedConfidence = output5.get(all(), all(), point(4), all(), all()); INDArray softmax = output5.get(all(), all(), interval(5, 5+c), all(), all()); List<DetectedObject> out = new ArrayList<>(); for( int i=0; i<mb; i++ ){ for( int x=0; x<w; x++ ){ for( int y=0; y<h; y++ ){ for( int box=0; box<b; box++ ){ double conf = predictedConfidence.getDouble(i, box, y, x); if(conf < threshold){ continue; } double px = output5.getDouble(i, box, 0, y, x); double py = output5.getDouble(i, box, 1, y, x); double pw = output5.getDouble(i, box, 2, y, x); double ph = output5.getDouble(i, box, 3, y, x); px += x; py += y; INDArray sm; try (MemoryWorkspace wsO = Nd4j.getMemoryManager().scopeOutOfWorkspaces()) { <START> sm = softmax.get(point(i), point(box), all(), point(x), point(y)).dup(); <END> } out.add(new DetectedObject(i, px, py, pw, ph, sm, conf)); } } } } return out; }</code><technical_language>I x y reversed here? explain trouble classification part... @yquemener</technical_language>

Target:
public List<DetectedObject> getPredictedObjects(INDArray networkOutput, double threshold){ if(networkOutput.rank() != 4){ throw new IllegalStateException("Invalid network output activations array: should be rank 4. Got array " + "with shape " + Arrays.toString(networkOutput.shape())); } if(threshold < 0.0 || threshold > 1.0){ throw new IllegalStateException("Invalid threshold: must be in range [0,1]. Got: " + threshold); } int mb = networkOutput.size(0); int h = networkOutput.size(2); int w = networkOutput.size(3); int b = layerConf().getBoundingBoxes().size(0); int c = (networkOutput.size(1)/b)-5; INDArray output5 = networkOutput.dup('c').reshape(mb, b, 5+c, h, w); INDArray predictedConfidence = output5.get(all(), all(), point(4), all(), all()); INDArray softmax = output5.get(all(), all(), interval(5, 5+c), all(), all()); List<DetectedObject> out = new ArrayList<>(); for( int i=0; i<mb; i++ ){ for( int x=0; x<w; x++ ){ for( int y=0; y<h; y++ ){ for( int box=0; box<b; box++ ){ double conf = predictedConfidence.getDouble(i, box, y, x); if(conf < threshold){ continue; } double px = output5.getDouble(i, box, 0, y, x); double py = output5.getDouble(i, box, 1, y, x); double pw = output5.getDouble(i, box, 2, y, x); double ph = output5.getDouble(i, box, 3, y, x); px += x; py += y; INDArray sm; try (MemoryWorkspace wsO = Nd4j.getMemoryManager().scopeOutOfWorkspaces()) { sm = softmax.get(point(i), point(box), all(), point(y), point(x)).dup(); } out.add(new DetectedObject(i, px, py, pw, ph, sm, conf)); } } } } return out; }