SlideShare a Scribd company logo
Introduction to CoreML
By
Ali
Who are we ?
• Software Engineers at VentureDive

• Graduated from NED University of Engineering and
Technology

• Doing iOS development for last 2 years
Machine Learning
Machine learning is USING DATA to answer
QUESTIONS
Steps for Machine Learning
• Data collection and processing 

• Model Training and Testing 

• Inference / prediction
What is a Model
• A function that take some inputs and give one or more
outputs on the basis of the knowledge it gains from the
data on which it was trained
About CoreML
• Apple’s Machine learning framework 

• iOS 11

• Integrate trained machine learning model into your app

• MacOS , iOS , tvOS and watchOS

• Predictive Purpose
Applications
• Real-Time image detection

• Next word predictions

• Entity Recognition

• Music tagging

• Semantic Analysis

• Style Transfer

• Face Detection
Examples
Apple Uses Machine
Learning
• Photos App (People Detection)

• Keyboard (Next word prediction)

• Smart Watches (Handwriting detection)
Let’s Dive Deep in
CoreML
Architecture
Model Types
Pros
• Runs locally

• Privacy

• No server costs

• Hardware Optimized

• Real time machine learning
Cons
• Unsupervised and Reinforcement learning is not
supported

• Training of model can’t be done
• DEMO 1
Summary
• CoreML makes it easy to integrate machine learning models into
your app (Drag and drop and you get you get code interface )

• Hardware optimized

• Compatible with popular format 

• CoreML has rich data type support
Possible I/O
• Numeric (House price prediction)

• Categorical

• Arrays (video and gesture )

• Dictionaries (text based application)

• Images(flower classier)
Obtaining Model
• Pre-trained model (models with a .mlmodel file extension) 

• Pre-trained (open source models) + convert —> .mlmodel

• Collect data + trained on open source + convert —
> .mlmodel
Obtaining Model
Converting Trained Models to Core ML
• Core ML Tools (including Keras, Caffe, scikit-learn,
libsvm, and XGBoost)

• TensorFlow converter

• MXNet converter
Core ML Tools
Core ML Tools
Core ML Tools
• Converters (set of converters one for each popular training)

• Build your own converters using CoreML Bindings and
Converter Library

• CoreML Specification (Read and write api in cormel model
format directly OR Write your own model)
DEMO 2
• Caffe: an open framework for deep learning developed by Berkeley Vision and
Learning Center

• Python 2.7.

• import coremltools

• deploy.prototxt – describes the structure of the neural network

• oxford102.caffemodel – the trained data model in Caffe format.

• class_labels.txt – contains a list of all the flowers that the model is able to
recognize.

• coreml_model = coremltools.converters.caffe.convert(('oxford102.caffemodel',
'deploy.prototxt'), image_input_names='data', class_labels=‘class_labels.txt')

• coreml_model.save('Flowers.mlmodel')
Abstract Overview 

Convolutional Neural Network
• Convolutional Neural Networks (ConvNets or CNNs) are a category of Neural Networks 

• Very effective in areas such as image classification

• Each layer is not connected to every other neuron in the next layer , only part of the image is
connected called receptive field

• There are a few distinct types of Layers (e.g. CONV/FC/RELU(Activation)/POOL are by far
the most popular), 

• Layers are basically series of operations (called convolutional blocks)
Abstract Overview 

Convolutional Neural Network
CONV
POOLING
• Makes the representation smaller and more manageable 

• Spatially Downsamples , gives more relevant part
Activation and Regularization
• Activation is helpful to train nonlinear function (ReLU)

• Regularization help CNN to avoid overfitting and generalize
classification(L1,L2,DropOut)

• Gradient Descent for back propagation (local minima)

• Dense layer: A linear operation in which every input is connected to every output by
a weight (so there are n_inputs * n_outputs weights - which can be a lot!). Generally
followed by a non-linear activation function
DEMO 3
• Train model in keras

• Convert keras model into mlmodel

• Epoch = No of times an entire data sets are fed to the
network (To help neural n/w to get better)

• Batch : every single time to get my neural network train
CNN
DEMO 4
• Convert tensor flow model into mlmodel

• import tfcoreml (google support)

• https://github.com/tf-coreml/tf-coreml

• https://github.com/tf-coreml/tf-coreml/issues/91

• https://github.com/tf-coreml/tf-coreml/issues/80
Downloading and Compiling a Model on the
User's Device
• Downloading and compiling models on the user's device – rather
than bundling them with your app – is beneficial for specific use
cases

• If your app has a variety of features supported by different
models, downloading the models individually in the background
could save on bandwidth and storage, by not forcing the user to
download every model. Likewise, different locales or regions
might use different Core ML models.

• The model definition file (.mlmodel) must be on the device before
it's compiled.

• let compiledUrl = try MLModel.compileModel(at: modelUrl)

• let model = try MLModel(contentsOf: compiledUrl)
Custom Layers
• The field of neural networks is constantly evolving, with new architectures
and layers rapidly being created to solve new problems

• Models that use custom layers require these OS versions or later: iOS 11.2,

• If you acquire a third-party model that uses custom layers, the Xcode UI for
your model will look slightly different than it would for a model with no
custom layers

• Very familiar with the architecture of your neural network and the intended
behavior of your custom layer

• add_custom_layers=True, which tells the converter to detect custom layers

• http://machinethink.net/blog/coreml-custom-layers/

•
Custom Layers
DEMO 5
• Simple and efficient tools for data mining and data analysis

• In statistics, linear regression is a linear approach for
modelling the relationship between a scalar dependent
variable y and one or more explanatory variables (or
independent variables) denoted X.

• Price = 500 - 0.2*(Age of car)

• coreml_model = sklearn.convert(lm) 

• coreml_model.save('linear_model.mlmodel')

More Related Content

PDF
MLFlow: Platform for Complete Machine Learning Lifecycle
PDF
All about InfluxDB.
PDF
"Managing the Complete Machine Learning Lifecycle with MLflow"
PPTX
Machine learning introduction
PDF
What’s New with Databricks Machine Learning
PDF
Introduction to MLflow
PDF
Build your own ASR engine
PDF
MLflow: A Platform for Production Machine Learning
MLFlow: Platform for Complete Machine Learning Lifecycle
All about InfluxDB.
"Managing the Complete Machine Learning Lifecycle with MLflow"
Machine learning introduction
What’s New with Databricks Machine Learning
Introduction to MLflow
Build your own ASR engine
MLflow: A Platform for Production Machine Learning

What's hot (20)

PDF
Building a Feature Store around Dataframes and Apache Spark
PDF
Unified MLOps: Feature Stores & Model Deployment
PDF
Machine Learning with PyCaret
PDF
Neural networks and deep learning
PDF
Ml ops intro session
PDF
Distributed computing with Ray. Find your hyper-parameters, speed up your Pan...
PPTX
Python Streaming Pipelines with Beam on Flink
PDF
Machine learning life cycle
PDF
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
PDF
Observability for Data Pipelines With OpenLineage
PPTX
Introduction to Machine Learning
PPTX
MLOps.pptx
PDF
Building an ML Platform with Ray and MLflow
PPTX
Deep learning with tensorflow
ODP
Monitoring With Prometheus
PDF
Web-Scale Graph Analytics with Apache® Spark™
PDF
Databricks Overview for MLOps
PDF
Introduction of Deep Learning
PPTX
Deep learning
PDF
Luigi presentation NYC Data Science
Building a Feature Store around Dataframes and Apache Spark
Unified MLOps: Feature Stores & Model Deployment
Machine Learning with PyCaret
Neural networks and deep learning
Ml ops intro session
Distributed computing with Ray. Find your hyper-parameters, speed up your Pan...
Python Streaming Pipelines with Beam on Flink
Machine learning life cycle
MLflow: Infrastructure for a Complete Machine Learning Life Cycle with Mani ...
Observability for Data Pipelines With OpenLineage
Introduction to Machine Learning
MLOps.pptx
Building an ML Platform with Ray and MLflow
Deep learning with tensorflow
Monitoring With Prometheus
Web-Scale Graph Analytics with Apache® Spark™
Databricks Overview for MLOps
Introduction of Deep Learning
Deep learning
Luigi presentation NYC Data Science
Ad

Similar to CoreML (20)

PDF
TensorFlow and Keras: An Overview
PPTX
EMF-IncQuery presentation at TOOLS 2012
PDF
convolutional neural networks, swift and iOS 11
PDF
Introducing ios core ml
PPT
Object oriented programming_Unit1_Introduction.ppt
PPTX
.net Based Component Technologies
PDF
What Linux can learn from Solaris performance and vice-versa
KEY
On the Use of an Internal DSL for Enriching EMF Models
PDF
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
PPTX
DotNet Conf Madrid 2019 - Whats New in ML.NET
PDF
Learn Entity Framework in a day with Code First, Model First and Database First
PPT
Introducing object oriented programming (oop)
PPTX
Java Programming concept
PPTX
PPTX
How to Build Deep Learning Models
PPTX
Squeezing Deep Learning Into Mobile Phones
PPTX
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
PDF
What's Inside a JVM?
PDF
Cutting Edge Computer Vision for Everyone
PPTX
Entity framework introduction sesion-1
TensorFlow and Keras: An Overview
EMF-IncQuery presentation at TOOLS 2012
convolutional neural networks, swift and iOS 11
Introducing ios core ml
Object oriented programming_Unit1_Introduction.ppt
.net Based Component Technologies
What Linux can learn from Solaris performance and vice-versa
On the Use of an Internal DSL for Enriching EMF Models
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
DotNet Conf Madrid 2019 - Whats New in ML.NET
Learn Entity Framework in a day with Code First, Model First and Database First
Introducing object oriented programming (oop)
Java Programming concept
How to Build Deep Learning Models
Squeezing Deep Learning Into Mobile Phones
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
What's Inside a JVM?
Cutting Edge Computer Vision for Everyone
Entity framework introduction sesion-1
Ad

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Electronic commerce courselecture one. Pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25-Week II
Assigned Numbers - 2025 - Bluetooth® Document
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Electronic commerce courselecture one. Pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Tartificialntelligence_presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Mobile App Security Testing_ A Comprehensive Guide.pdf

CoreML

  • 2. Who are we ? • Software Engineers at VentureDive • Graduated from NED University of Engineering and Technology • Doing iOS development for last 2 years
  • 3. Machine Learning Machine learning is USING DATA to answer QUESTIONS
  • 4. Steps for Machine Learning • Data collection and processing • Model Training and Testing • Inference / prediction
  • 5. What is a Model • A function that take some inputs and give one or more outputs on the basis of the knowledge it gains from the data on which it was trained
  • 6. About CoreML • Apple’s Machine learning framework • iOS 11 • Integrate trained machine learning model into your app • MacOS , iOS , tvOS and watchOS • Predictive Purpose
  • 7. Applications • Real-Time image detection • Next word predictions • Entity Recognition • Music tagging • Semantic Analysis • Style Transfer • Face Detection
  • 9. Apple Uses Machine Learning • Photos App (People Detection) • Keyboard (Next word prediction) • Smart Watches (Handwriting detection)
  • 10. Let’s Dive Deep in CoreML
  • 13. Pros • Runs locally • Privacy • No server costs • Hardware Optimized • Real time machine learning
  • 14. Cons • Unsupervised and Reinforcement learning is not supported • Training of model can’t be done
  • 16. Summary • CoreML makes it easy to integrate machine learning models into your app (Drag and drop and you get you get code interface ) • Hardware optimized • Compatible with popular format • CoreML has rich data type support
  • 17. Possible I/O • Numeric (House price prediction) • Categorical • Arrays (video and gesture ) • Dictionaries (text based application) • Images(flower classier)
  • 18. Obtaining Model • Pre-trained model (models with a .mlmodel file extension) • Pre-trained (open source models) + convert —> .mlmodel • Collect data + trained on open source + convert — > .mlmodel
  • 20. Converting Trained Models to Core ML • Core ML Tools (including Keras, Caffe, scikit-learn, libsvm, and XGBoost) • TensorFlow converter • MXNet converter
  • 23. Core ML Tools • Converters (set of converters one for each popular training) • Build your own converters using CoreML Bindings and Converter Library • CoreML Specification (Read and write api in cormel model format directly OR Write your own model)
  • 24. DEMO 2 • Caffe: an open framework for deep learning developed by Berkeley Vision and Learning Center • Python 2.7. • import coremltools • deploy.prototxt – describes the structure of the neural network • oxford102.caffemodel – the trained data model in Caffe format. • class_labels.txt – contains a list of all the flowers that the model is able to recognize. • coreml_model = coremltools.converters.caffe.convert(('oxford102.caffemodel', 'deploy.prototxt'), image_input_names='data', class_labels=‘class_labels.txt') • coreml_model.save('Flowers.mlmodel')
  • 25. Abstract Overview 
 Convolutional Neural Network • Convolutional Neural Networks (ConvNets or CNNs) are a category of Neural Networks  • Very effective in areas such as image classification • Each layer is not connected to every other neuron in the next layer , only part of the image is connected called receptive field • There are a few distinct types of Layers (e.g. CONV/FC/RELU(Activation)/POOL are by far the most popular), • Layers are basically series of operations (called convolutional blocks)
  • 27. CONV
  • 28. POOLING • Makes the representation smaller and more manageable • Spatially Downsamples , gives more relevant part
  • 29. Activation and Regularization • Activation is helpful to train nonlinear function (ReLU) • Regularization help CNN to avoid overfitting and generalize classification(L1,L2,DropOut) • Gradient Descent for back propagation (local minima) • Dense layer: A linear operation in which every input is connected to every output by a weight (so there are n_inputs * n_outputs weights - which can be a lot!). Generally followed by a non-linear activation function
  • 30. DEMO 3 • Train model in keras • Convert keras model into mlmodel • Epoch = No of times an entire data sets are fed to the network (To help neural n/w to get better) • Batch : every single time to get my neural network train
  • 31. CNN
  • 32. DEMO 4 • Convert tensor flow model into mlmodel • import tfcoreml (google support) • https://github.com/tf-coreml/tf-coreml • https://github.com/tf-coreml/tf-coreml/issues/91 • https://github.com/tf-coreml/tf-coreml/issues/80
  • 33. Downloading and Compiling a Model on the User's Device • Downloading and compiling models on the user's device – rather than bundling them with your app – is beneficial for specific use cases • If your app has a variety of features supported by different models, downloading the models individually in the background could save on bandwidth and storage, by not forcing the user to download every model. Likewise, different locales or regions might use different Core ML models. • The model definition file (.mlmodel) must be on the device before it's compiled. • let compiledUrl = try MLModel.compileModel(at: modelUrl) • let model = try MLModel(contentsOf: compiledUrl)
  • 34. Custom Layers • The field of neural networks is constantly evolving, with new architectures and layers rapidly being created to solve new problems • Models that use custom layers require these OS versions or later: iOS 11.2, • If you acquire a third-party model that uses custom layers, the Xcode UI for your model will look slightly different than it would for a model with no custom layers • Very familiar with the architecture of your neural network and the intended behavior of your custom layer • add_custom_layers=True, which tells the converter to detect custom layers • http://machinethink.net/blog/coreml-custom-layers/ •
  • 36. DEMO 5 • Simple and efficient tools for data mining and data analysis • In statistics, linear regression is a linear approach for modelling the relationship between a scalar dependent variable y and one or more explanatory variables (or independent variables) denoted X. • Price = 500 - 0.2*(Age of car) • coreml_model = sklearn.convert(lm) • coreml_model.save('linear_model.mlmodel')