Loading repository data…
Loading repository data…
hwchong / repository
This is a sample project demonstrating the use of Keras (Tensorflow) for the training of a MNIST model for handwriting recognition using CoreML on iOS 11 for inference.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This is a sample application that demonstrates the end-to-end process of training a custom model for digit recognition (MNIST) from scratch using Keras running on Tensorflow 1.1 as its backend and generating a CoreML model for inference on iOS 11.
The fastest way to get started is to install Docker for your machine.
Once Docker has been installed, either pull a pre-made Docker image Docker Hub:
$ docker pull hwchong/kerastraining4coreml
or build it in the Training folder in the repo:
$ cd Training
$ docker build -t 'inserttagname' .
To start the Jupyter Notebook server which will serve as your Python REPL and IDE execute the following command:
$ docker run -p 8888:8888 -p 6006:6006 hwchong/kerastraining4coreml
If using your own tag name, remember to subsitute hwchong/kerastraining4coreml with whatever you used to build your Docker Image
Remember to watch the Terminal to get the token required to sign into your Jupyter Notebook instance.
Launching the Jupyter Notebook will present you with two notebooks. To start training a Deep Neural Network consisting of a Convolutional Neural Network, execute the Keras-1.2.2-mnist-cnn.ipynb file.
Running the training will take ~15 minutes on a MacBook Pro.
Once model training has been completed, save the model file.
To generate a coremlmodel file, run the model conversion notebook Keras-CoreML.ipynb . Once you have this file, download it to and insert it into your Xcode project.
Please refer the the Inference folder and the included MNIST_DRAW to see how to implement the custom generated Keras coremlmodel.