Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning Projects for Mobile Applications

You're reading from   Machine Learning Projects for Mobile Applications Build Android and iOS applications using TensorFlow Lite and Core ML

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788994590
Length 246 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Karthikeyan NG Karthikeyan NG
Author Profile Icon Karthikeyan NG
Karthikeyan NG
Arrow right icon
View More author details
Toc

The implementation on iOS using Core ML

It is now time to jump into the coding part of the application. We are using a model developed using the Caffe deep learning framework by Berkeley AI Research (BAIR) team as well as the community of contributors. As a first step, we need to convert the existing Caffe models into Core ML models to be utilized in our application:

//Downloading Age and Gender models 
wget
http://www.openu.ac.il/home/hassner/projects/cnn_agegender/cnn_age_gen
der_models_and_data.0.0.2.zip
unzip -a cnn_age_gender_models_and_data.0.0.2.zip

Now, go to the extracted folder and convert the model into a Core ML model:

import coremltools

folder = 'cnn_age_gender_models_and_data.0.0.2'

coreml_model = coremltools.converters.caffe.convert(
(folder + '/age_net.caffemodel', folder + '/deploy_age.prototxt'),
image_input_names = &apos...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime