We want to leverage the image classifier as an API to use them in external applications. An API can be accessed externally, and prediction results can be obtained without setting up anything. In this recipe, we will create an API endpoint for the image classifier.
Creating an API endpoint for the image classifier
How to do it...
- Persist the model using ModelSerializer:
File file = new File("cnntrainedmodel.zip");
ModelSerializer.writeModel(model,file,true);
ModelSerializer.addNormalizerToModel(file,scaler);
- Restore the trained model using ModelSerializer to perform predictions:
MultiLayerNetwork network = ModelSerializer.restoreMultiLayerNetwork(modelFile);
NormalizerStandardize normalizerStandardize = ModelSerializer...