// TODO: we should consider the model as not only the model, but also the
// input transforms
// for that model.
public Map<String, Double> classifyImageVGG16(IplImage iplImage) throws IOException {
    NativeImageLoader loader = new NativeImageLoader(224, 224, 3);
    BufferedImage buffImg = OpenCV.toBufferedImage(iplImage);
    INDArray image = loader.asMatrix(buffImg);
    // TODO: we should consider the model as not only the model, but also the
    // input transforms
    // for that model.
    DataNormalization scaler = new VGG16ImagePreProcessor();
    scaler.transform(image);
    INDArray[] output = vgg16.output(false, image);
    log.info("Complete with output from vgg16..");
    // TODO: return a more native datastructure!
    // String predictions = TrainedModels.VGG16.decodePredictions(output[0]);
    // log.info("Image Predictions: {}", predictions);
    return decodeVGG16Predictions(output[0]);
  }
BufferedImage buffImg = OpenCV.toBufferedImage(iplImage);
INDArray image = loader.asMatrix(buffImg);
// TODO: we should consider the model as not only the model, but also the
// input transforms
// for that model.
DataNormalization scaler = new VGG16ImagePreProcessor();
scaler.transform(image);
public Map<String, Double> classifyImageVGG16(IplImage iplImage) throws IOException {
NativeImageLoader loader = new NativeImageLoader(224, 224, 3);
BufferedImage buffImg = OpenCV.toBufferedImage(iplImage);
INDArray image = loader.asMatrix(buffImg);
// TODO: we should consider the model as not only the model, but also the
// input transforms
// for that model.
DataNormalization scaler = new VGG16ImagePreProcessor();
scaler.transform(image);
INDArray[] output = vgg16.output(false, image);
log.info("Complete with output from vgg16..");
// TODO: return a more native datastructure!
// String predictions = TrainedModels.VGG16.decodePredictions(output[0]);
// log.info("Image Predictions: {}", predictions);
return decodeVGG16Predictions(output[0]);
}
public Map<String, Double> classifyImageVGG16(IplImage iplImage) throws IOException {
NativeImageLoader loader = new NativeImageLoader(224, 224, 3);
BufferedImage buffImg = OpenCV.toBufferedImage(iplImage);
INDArray image = loader.asMatrix(buffImg);
// TODO: we should consider the model as not only the model, but also the
// input transforms
// for that model.
DataNormalization scaler = new VGG16ImagePreProcessor();
scaler.transform(image);
INDArray[] output = vgg16.output(false, image);
log.info("Complete with output from vgg16..");
// TODO: return a more native datastructure!
// String predictions = TrainedModels.VGG16.decodePredictions(output[0]);
// log.info("Image Predictions: {}", predictions);
return decodeVGG16Predictions(output[0]);
}