System.out.println("Load model...");
net = ModelSerializer.restoreComputationGraph(modelFileName);
1 Like
After loading MNIST model, which should I use function to the â/home/admins/desktop/1.jpgâ recognize the file number???
Hi,
you can do this:
NativeImageLoader loader = new NativeImageLoader(28, 28, 1);
ImagePreProcessingScaler imagePreProcessingScaler = new ImagePreProcessingScaler(0, 1);
File imageFile = new File("/home/admins/desktop/1.jpg");
INDArray indArray = loader.asMatrix(imageFile);
imagePreProcessingScaler.transform(indArray);
INDArray results = model.outputSingle(indArray);
and then inspect results and take the index of the highest value.
See here for similar examples:
1 Like