Real time image classification on iOS using a CoreML model exported from Custom Vision Service
Switch branches/tags
Clone or download
Latest commit 37a591b Sep 15, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial commit Sep 14, 2017
CustomVision fix a UI refresh issue, increase confidence value Sep 14, 2017
.gitignore Adding sample code. Sep 14, 2017 Initial commit Sep 14, 2017 Initial commit Sep 14, 2017 Initial commit Sep 14, 2017 fixed markdown mistake in links Sep 14, 2017
ThirdPartyNotices.txt Create ThirdPartyNotices.txt Sep 14, 2017

services platforms author
swift, iOS

Sample iOS application for models exported from Custom Vision Service

This sample application demonstrates how to take a model exported from the Custom Vision Service in the CoreML format and add it to a template iOS 11 application for real-time image classification.

Getting Started



  1. clone the repository and open the project in XCode
  2. launch your application to your iOS device

Replacing the sample model with your own classifier

The model provided with the sample recognizes some fruit (apples, bananas, coconuts, oranges, passionfruit, pineapples, strawberries). to replace it with your own model exported from the Custom Vision Service do the following, and then build and launch the application:

  1. Create and train a classifer with the Custom Vision Service. You must choose a "compact" domain such as General (compact) to be able to export your classifier. If you have an existing classifier you want to export instead, convert the domain in "settings" by clicking on the gear icon at the top right. In setting, choose a "compact" model, Save, and Train your project.
  2. Export your model by going to the Performance tab. Select an iteration trained with a compact domain, an "Export" button will appear. Click on Export then iOS then Export. Click the Download button when it appears. A .mlmodel file will download (you can also do all of this programatically with the Custom Vision Service Training API.
  3. Drop your .mlmodel file into your XCode Project.
  4. Replace Fruit.mlmodel with the name of your model in ViewController.swift.


The demo application includes a fruit recognition model. This is a screenshot.

Screenshot of sample application