I have the following code snippet but getLabels() does not work for dl4j version 1.0.0-m2.1. I would not wish to manually use this: String labels = {“Eight”, “Five”, “Four”, “Nine”, “One”, “Seven”, “Six”, “Three”, “Two”, “Zero”}; to access class lable names. Thank you
// Load the image and convert it to a 4D array
NativeImageLoader loader = new NativeImageLoader(height, width, channels);
INDArray testimage = loader.asMatrix(grabbedImage);
// testimage = testimage.reshape(1, 3, 96, 96);
// Normalize the pixel values to be between 0 and 1
DataNormalization scalar = new ImagePreProcessingScaler(0, 1);
//then call that scalar on the image dataset
scalar.transform(testimage);
// Pass the input through the model to get the predictions
INDArray[] embeddings = model.output(testimage);
// Get the output layer index
int outputLayerIdx = model.getConfiguration().getNetworkOutputs().size() - 1;
// Get the output layer
Layer outputLayer = model.getLayer(model.getConfiguration().getNetworkOutputs().get(outputLayerIdx));
// Get the labels for the output layer
String[] labels = ((BaseOutputLayer) outputLayer.conf().getLayer()).getLabels();