public class ModelOutputDecoder
extends java.lang.Object
implements java.io.Serializable, weka.core.OptionHandler
Constructor and Description |
---|
ModelOutputDecoder() |
Modifier and Type | Method and Description |
---|---|
TopNPredictions |
decodePredictions(org.nd4j.linalg.api.ndarray.INDArray predictions)
Decode predictions, without any image or model name.
|
TopNPredictions |
decodePredictions(org.nd4j.linalg.api.ndarray.INDArray predictions,
java.lang.String imageName,
java.lang.String modelName)
Main entrypoint - decode the model predictions, saving the image and model name alongside it.
|
ClassmapType |
getBuiltInClassMap() |
java.lang.String[] |
getClasses()
Parses the classmap file into a String[]
|
java.io.File |
getClassMapFile() |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
java.util.Enumeration<weka.core.Option> |
listOptions()
Returns an enumeration describing the available options.
|
static java.lang.String[] |
parseClassmap(weka.core.Instances instances)
Get a classmap from a set of instances.
|
static java.lang.String[] |
parseClassmapFromArff(java.lang.String filepath)
Parse a classmap from a valid .arff file.
|
static java.lang.String[] |
parseClassmapFromCsv(java.lang.String filepath)
Parse a classmap from a valid .csv dataset.
|
void |
setBuiltInClassMap(ClassmapType classMap) |
void |
setClassMapFile(java.io.File f) |
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
public TopNPredictions decodePredictions(org.nd4j.linalg.api.ndarray.INDArray predictions) throws java.lang.Exception
predictions
- Predictions to decodejava.lang.Exception
- Exception.public TopNPredictions decodePredictions(org.nd4j.linalg.api.ndarray.INDArray predictions, java.lang.String imageName, java.lang.String modelName) throws java.lang.Exception
predictions
- Predictions to decodeimageName
- Name of the image used for predictionmodelName
- Name of the model used for predictionjava.lang.Exception
- exceptionpublic static java.lang.String[] parseClassmapFromArff(java.lang.String filepath) throws java.io.IOException
filepath
- Filepath to arff filejava.io.IOException
- file exception.public static java.lang.String[] parseClassmapFromCsv(java.lang.String filepath) throws java.io.IOException
filepath
- Filepath to a valid .csv datasetjava.io.IOException
- file exception.public static java.lang.String[] parseClassmap(weka.core.Instances instances)
instances
- Instances to parse classes frompublic java.lang.String[] getClasses()
java.lang.Exception
@OptionMetadata(displayName="Built in class map", description="A predefined class map based on a specific dataset (IMAGENET, VGGFACE). Useful when using a pretrained zoo model as these are often trained on IMAGENET.", commandLineParamName="builtIn", commandLineParamSynopsis="-builtIn {IMAGENET, VGGFACE, CUSTOM}") public ClassmapType getBuiltInClassMap()
public void setBuiltInClassMap(ClassmapType classMap)
@OptionMetadata(displayName="Class map file", description="File containing mappings from class IDs to human-readable names - can be .txt or .arff", commandLineParamName="classMapFile", commandLineParamSynopsis="-classMapFile <file location>") public java.io.File getClassMapFile()
public void setClassMapFile(java.io.File f)
public java.util.Enumeration<weka.core.Option> listOptions()
listOptions
in interface weka.core.OptionHandler
public java.lang.String[] getOptions()
getOptions
in interface weka.core.OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface weka.core.OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supported