Lars Gregori, SAP Hybris
November 25, 2017
Using A Trained Model
On Your Mobile Device
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 2
CoreML
▪ What is CoreML?
Train a model
▪ Train, convert, and add a model to an app.
Use a model
▪ Add an available model to an app.
Agenda
CoreML
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 4
A trained model is the result of applying a machine learning algorithm
to a set of training data.
The model makes predictions based on new input data.
CoreML
https://developer.apple.com/documentation/coreml
… integrates trained machine learning models into your app.
XOR example
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 6
0 xor 0 = 0
0 xor 1 = 1
1 xor 0 = 1
1 xor 1 = 0
XOR
if a != b
INTERNAL© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 7
DEMO
Inception v3 example
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 9
arXiv:1512.00567 - Rethinking the Inception Architecture for Computer Vision
Inception v3
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 10
Inceptionv3.mlmodel
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 11
Inceptionv3.mlmodel
INTERNAL© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 12
INTERNAL© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 13
DEMO
Style transfer example
INTERNAL© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 15https://developer.apple.com/documentation/coreml/converting_trained_models_to_core_ml
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 16
Style transfer with Torch & CoreML
https://blog.prismalabs.ai/diy-prisma-app-with-coreml-6b4994cc99e1
INTERNAL© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 17
DEMO
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 18
Summary
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 19
Tensorflow Mobile
Tensorflow Lite
Android?
PUBLIC© 2017 SAP SE or an SAP affiliate company. All rights reserved. ǀ 20
CoreML

https://developer.apple.com/documentation/coreml
XOR example

https://amundtveit.com/2017/06/07/keras-deep-learning-with-apples-coremltools-on-ios-11-part-1/
Rethinking the Inception Architecture for Computer Vision.

https://arxiv.org/abs/1512.00567
Torch7 -> CoreML 

https://github.com/prisma-ai/torch2coreml
Awesome Core ML Models

https://github.com/likedan/Awesome-CoreML-Models
Links
Thank you.
Lars Gregori, SAP Hybris
@choas
Hi Lars …
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.
The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components 

of other software vendors. National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated
companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are 

set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release
any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/
or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information
in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various 

risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements,
and they should not be relied upon in making purchasing decisions.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) 

in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. 

See http://global.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.
© 2017 SAP SE or an SAP affiliate company. All rights reserved.

Using a trained model on your mobile device

  • 1.
    Lars Gregori, SAPHybris November 25, 2017 Using A Trained Model On Your Mobile Device
  • 2.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 2 CoreML ▪ What is CoreML? Train a model ▪ Train, convert, and add a model to an app. Use a model ▪ Add an available model to an app. Agenda
  • 3.
  • 4.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 4 A trained model is the result of applying a machine learning algorithm to a set of training data. The model makes predictions based on new input data. CoreML https://developer.apple.com/documentation/coreml … integrates trained machine learning models into your app.
  • 5.
  • 6.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 6 0 xor 0 = 0 0 xor 1 = 1 1 xor 0 = 1 1 xor 1 = 0 XOR if a != b
  • 7.
    INTERNAL© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 7 DEMO
  • 8.
  • 9.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 9 arXiv:1512.00567 - Rethinking the Inception Architecture for Computer Vision Inception v3
  • 10.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 10 Inceptionv3.mlmodel
  • 11.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 11 Inceptionv3.mlmodel
  • 12.
    INTERNAL© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 12
  • 13.
    INTERNAL© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 13 DEMO
  • 14.
  • 15.
    INTERNAL© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 15https://developer.apple.com/documentation/coreml/converting_trained_models_to_core_ml
  • 16.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 16 Style transfer with Torch & CoreML https://blog.prismalabs.ai/diy-prisma-app-with-coreml-6b4994cc99e1
  • 17.
    INTERNAL© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 17 DEMO
  • 18.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 18 Summary
  • 19.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 19 Tensorflow Mobile Tensorflow Lite Android?
  • 20.
    PUBLIC© 2017 SAPSE or an SAP affiliate company. All rights reserved. ǀ 20 CoreML
 https://developer.apple.com/documentation/coreml XOR example
 https://amundtveit.com/2017/06/07/keras-deep-learning-with-apples-coremltools-on-ios-11-part-1/ Rethinking the Inception Architecture for Computer Vision.
 https://arxiv.org/abs/1512.00567 Torch7 -> CoreML 
 https://github.com/prisma-ai/torch2coreml Awesome Core ML Models
 https://github.com/likedan/Awesome-CoreML-Models Links
  • 21.
    Thank you. Lars Gregori,SAP Hybris @choas Hi Lars …
  • 22.
    No part ofthis publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components 
 of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are 
 set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/ or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various 
 risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) 
 in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. 
 See http://global.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices. © 2017 SAP SE or an SAP affiliate company. All rights reserved.