public class TopNPredictions
extends java.lang.Object
Constructor and Description |
---|
TopNPredictions()
Initialize.
|
TopNPredictions(java.lang.String imageName,
java.lang.String modelName)
Initialize the top N predictions.
|
Modifier and Type | Method and Description |
---|---|
int |
getN() |
Prediction |
getPrediction(int i)
Get the prediction at index i.
|
Prediction |
getTopPrediction() |
Prediction[] |
getTopPredictions() |
void |
process(org.nd4j.linalg.api.ndarray.INDArray predictions,
java.lang.String[] classes)
Main entrypoint, decodes predictions into a TopNPredictions object.
|
void |
setN(int n) |
java.lang.String |
toSummaryString()
Return a summary string of the stored predictions.
|
java.lang.String |
toSummaryString(java.lang.String imageName,
java.lang.String zooModelName)
Return a summary string of the stored predictions, headed with the given image and model name.
|
public TopNPredictions()
public TopNPredictions(java.lang.String imageName, java.lang.String modelName)
imageName
- Name of imagemodelName
- Name of modelpublic void process(org.nd4j.linalg.api.ndarray.INDArray predictions, java.lang.String[] classes) throws java.lang.Exception
predictions
- Raw model predictionsclasses
- Class mapjava.lang.Exception
- image exceptionpublic java.lang.String toSummaryString()
public java.lang.String toSummaryString(java.lang.String imageName, java.lang.String zooModelName)
imageName
- Image used for predictionzooModelName
- Model used for predictionpublic int getN()
public void setN(int n)
public Prediction getPrediction(int i)
i
- Index of prediction to get.public Prediction getTopPrediction()
public Prediction[] getTopPredictions()