Skip to content
Simple convolutional neural network to predict handwritten digits using Keras + CoreML for WWDC '18 scholarship [Accepted]
Jupyter Notebook Swift
Branch: master
Clone or download
Latest commit 995618c Apr 23, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets Final touches Mar 25, 2018
Jupyter Update ml model in playground Mar 26, 2018
MNIST+CoreML.playground Upload repo name Mar 26, 2018
.gitignore Initial commit Mar 24, 2018
LICENSE Initial commit Mar 24, 2018
MNIST.mlmodel Add all probabilities button Mar 24, 2018
README.md Update README.md Apr 23, 2018

README.md

MNIST + CoreML

Simple convolutional neural network to predict handwritten digits using Keras + CoreML built for WWDC '18 scholarship submission [Accepted]

MNIST + CoreML

What is a Convolutional Neural Network ? 🤔

“A convolutional neural network is a class of deep, feed-forward artificial neural networks that have successfully been applied to analyzing visual imagery.

They were inspired by biological processes in that the connectivity pattern between neurons resembles the organization of the animal visual cortex. Individual cortical neurons respond to stimuli only in a restricted region of the visual field known as the receptive field. The receptive fields of different neurons partially overlap such that they cover the entire visual field.”

☝️ From Wikipedia


CONVNet simulation

☝️ Watch the full video on YouTube by Denis Dmitriev


The MNIST Dataset ✍️

The MNIST database is arguably the most famous database in the field of machine learning; it is a large database of 28x28 pixel images of handwritten digits created in 1999 by Yann LeCun.


The Model 💻

Our model consists of 12 layers:

  1. Input (28x28 pixel image)
  2. Conv2D (Relu activation)
  3. MaxPooling2D
  4. Conv2D (Relu activation)
  5. MaxPooling2D
  6. Conv2D (Relu activation)
  7. MaxPooling2D
  8. Dropout (0.3)
  9. Flatten
  10. Dense
  11. Dropout (0.4)
  12. Dense (Softmax activation)

COVNet Model Visualization


Draw and classify digits in Playground Canvas 🎨

Run the MNIST+CoreML.playground on Xcode 9.0+ or Swift Playground app on the iPad


Creating and Training The Model 👩‍🏫

The model was created and trained using Keras (a high-level neural networks API, written in Python)

☝️ Run the Jupyter notebook to train the network on your own device 💯


Converting to CoreML 🧙‍

Core ML is a framework introduced by Apple at WWDC '17 to integrate machine learning models into iOS, tvOS, macOS and watchOS apps.

The coremltools python package makes it very easy to generate the .mlmodel file, then all you need to do is just drag and drop that file into your Xcode project and you're all set 😎


Credits and Thanks 🙏


Contributing

Your feedback is always appreciated and welcomed. If you find a bug in the source code, you can help me by submitting an issue. Even better you can submit a Pull Request with a fix :)


License 👨‍⚖️

This project is released under the MIT License

You can’t perform that action at this time.