Simple demo on how to convert and run a Keras deep learning model on macOS with CoreML
Clone or download
Latest commit c6596ff Sep 9, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmdLabel.xcodeproj
cmdLabel initial commit Sep 2, 2017
img initial commit Sep 2, 2017
README.md Update README.md Sep 9, 2017
create_and_save_ml_model.py initial commit Sep 2, 2017
environment.yml

README.md

Running a Keras machine learning model under macOS with coreML

see blog post

Requirements

  • Python 2 (unfortunately coremltools only supports Python 2 at the moment)
  • The python environment can be reproduced using the Anaconda/miniconda environment.yml file
  • macOS 10.13 beta and Xcode 9-beta

Data

  • Example images are included in the img folder. Note that these are lower resolution than the original images changes the classification results in some cases.

Model creation

Run create_and_save_ml_model.py to load a pretrained ResNet50 model, run it on example images and save it in the mlmodel format

Swift command line application

  • Add the ResNet50.mlmodel to the xcode library
  • Build the project
  • See example results
  • Find the compiled binary and run on an example image e.g. ./CmdSand /path/to/example.img