Git Product home page Git Product logo

mnist_draw's Introduction

End to end model training and inference using Keras (Tensorflow) and CoreML.

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.

Demo Gif

YouTube Video

Getting Started

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.

Training

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.

Conversion

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.

Deployment

Please refer the the Inference folder and the included MNIST_DRAW to see how to implement the custom generated Keras coremlmodel.

mnist_draw's People

Contributors

hrishikeshmane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mnist_draw's Issues

How to change output type of Core ML Model (Keras)

Hi Nice tutorial ! I also implemented same few days back and manage to add input to model as CVPixelBuffer. I have one question.. How can I make the output of ml model as number which it predicts and with probability instead of type MultiArray<Double,10>(Like flower example in WWDC). Should we have to create a custom keras layer class or use lambda layer?. I had search enough but couldnt find anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.