Train a model on fashion dataset

Get the code

Summary

Learn how to train your Fashion MNIST model with IBM Fabric for Deep Learning (FfDL) on Kubernetes Cluster configured with GPU. This model is defined in Keras and trained using TensorFlow with FfDL, which is deployed on Kubernetes GPU cluster. FfDL provides a scalable deep learning platform on Kubernetes by giving the option to leverage deep learning libraries like Caffe, Torch, and TensorFlow. In addition, we will show to wrap and deploy that model using Seldon, and then write an app to consume it.

Description

Fashion MNIST is a direct drop-in replacement for the original MNIST dataset. The dataset is made up of 60,000 training examples and 10,000 testing examples, where each example is a 28×28 grayscaled picture of various articles of clothing. The Fashion MNIST dataset is more difficult than the original MNIST, and thus serves as a more complete benchmarking tool.

The model being trained is a CNN with three convolutional layers followed by two dense layers. The job will run for 30 epochs, with a batch size of 128. Once wrapped, the model is ready to take input and return predictions of confidence in the picture being of a certain class.

The web app is designed to take uploaded images, display them on the web page, and show the names of the classes with the top three confidences. There is an accompanying word cloud, where the size of the word is correlated to the frequency of the class being the top choice for a picture.

Flow

flow

  1. User submits the Fashion MNIST model training job on his FfDL instance. FfDL trains the Fashion MNIST model to completion and stores the model file, resulting in an S3 compatible Object Storage.
  2. Once the model is trained, deploy Seldon to serve the model. User creates a Seldon deployment that takes the trained model from the Object Storage and serves it on Seldon along with Ambassador’s dynamic Ingress.
  3. User containerizes the web application and deploys it on Kubernetes. Then the web application can use the deep learning model hosted on Seldon to make predictions about the different types of fashions.

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.