Icon

Create_​MNIST_​Model_​For_​TensorFlow_​Serving

Create MNIST Model For TensorFlow Serving

This workflow trains a simple convolutional neural network (CNN) on the MNIST dataset via Keras. It then adds the 'serving' tag to the network and uploads it to S3 as saved model.

In order to run the example, please make sure you have the following KNIME extensions installed:

* KNIME Deep Learning - Keras Integration (Labs)
* KNIME Deep Learning - TensorFlow Integration
* KNIME Image Processing (Community Contributions Trusted)
* KNIME Image Processing - Deep Learning Extension (Community Contributions Trusted)

You also need a local Python installation that includes Keras. Please refer to https://www.knime.com/deeplearning#keras for installation recommendations and further information.

Acknowledgements:

The architecture of the created network was taken from https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py [1].

The enclosed pictures are from the MNIST dataset (http://yann.lecun.com/exdb/mnist/) [2].

[1] Chollet, Francois and others. Keras. https://github.com/fchollet/keras. 2015.

[2] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. "Gradient-based learning applied to document recognition." Proceedings of the IEEE, 86(11):2278-2324, November 1998.




Load or train a TensorFlow model The TensorFlow modelneeds to have the'serving' tag to work withTensorFlow Serving. Upload the TensorFlow model to the S3 bucket that is syncedby KNIME Edge. Write out the model locally or use it directly for predictions to test it. MNIST imagesMNIST imagestransform probabilitiesto predicted classes’ labelssimple, untrainedCNNinput: untrained net andtraining images with labelsoutput: trained net- -5 epochs(increase to improve accuracy)Write out locally.Select the bucket to upload toas working directory.input: trained netand test imagesoutput: probabilitiesof predicted digits Add 'serving' tagto TensorFlow model Preparetraining data Prepare test data Format results Image Viewer DL PythonNetwork Creator Keras NetworkLearner Keras to TensorFlowNetwork Converter TensorFlowNetwork Writer AmazonAuthentication Amazon S3 Connector Keras NetworkExecutor Scorer Upload TensorFlowmodel to S3 Load or train a TensorFlow model The TensorFlow modelneeds to have the'serving' tag to work withTensorFlow Serving. Upload the TensorFlow model to the S3 bucket that is syncedby KNIME Edge. Write out the model locally or use it directly for predictions to test it. MNIST imagesMNIST imagestransform probabilitiesto predicted classes’ labelssimple, untrainedCNNinput: untrained net andtraining images with labelsoutput: trained net- -5 epochs(increase to improve accuracy)Write out locally.Select the bucket to upload toas working directory.input: trained netand test imagesoutput: probabilitiesof predicted digits Add 'serving' tagto TensorFlow model Preparetraining data Prepare test data Format results Image Viewer DL PythonNetwork Creator Keras NetworkLearner Keras to TensorFlowNetwork Converter TensorFlowNetwork Writer AmazonAuthentication Amazon S3 Connector Keras NetworkExecutor Scorer Upload TensorFlowmodel to S3

Nodes

Extensions

Links