Sie sind auf Seite 1von 27

Course: SAP Leonardo Machine Learning Foundation – An Introduction

Unit 5: Ready-to-Use Functional Services


Ready-to-Use Functional Services
In the previous unit

▪ We discussed some business use cases for


enterprise machine learning
▪ You found out how SAP Leonardo ML enables
customers build their own intelligent applications
▪ We discussed how our partners use SAP
Leonardo ML to build intelligent applications

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 2


Ready-to-Use Functional Services
Enabling customers and partners to build the Intelligent Enterprise

Applications

SAP Leonardo ML Foundation End User

Functional Services

Enterprise System Image Speech Text Developer

Core Capabilities

Training APIs Consumption APIs Data Scientist

SAP Cloud Platform

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 3


Ready-to-Use Functional Services
Calling REST APIs through the SAP API Business Hub

Functional Service

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 4


Ready-to-Use Functional Services
Machine learning services portfolio

Image Speech Text

User Image Processing APIs


Customizable image classification
Which objects are shown in the image? Customizable image object detection
Human detection; Face detection
What is the text displayed in an image?
Customizable image feature extraction
Which pictures show identical persons? Face feature extraction
Optical character recognition (OCR); Scene text recognition
Image segmentation

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 5


Ready-to-Use Functional Services
Image classification and product image classification services

The image classification API calculates and returns a list of classifications along with their
probabilities for a given image.
0.7 Truck
0.2 Van
SAP Leonardo 0.05 SUV
Machine Learning 0.03 Compact
0.02 Coupe

SAP API Business Hub: https://api.sap.com/api/image_classification_api/resource

Customizable Image Classification


▪ Inference service for customizable image classification (the ready-to-use image classification and product
image classification services are accessible via this API)
▪ Training service for customizable image classification

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 6


Ready-to-Use Functional Services
Image feature extraction

Image feature extraction transforms a given image into abstract features that encode extracted
information about the content of the image.

0.042
= −0.053
𝑣Ԧ ⋮
SAP Leonardo
Machine Learning 0,078

SAP API Business Hub: https://api.sap.com/api/img_feature_extraction_api

Image features can be used for multiple applications:


▪ To implement content-aware image search
▪ To perform image clustering
▪ As an input to create a custom classification model
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 7
Ready-to-Use Functional Services
Similarity scoring

▪ Similarity scoring can be used to compare two vectors of the same dimension
▪ Two given vectors span a plane in which they are separated by an angle 𝜃. For small angles cosine
similarity outputs values close to one.

𝑥Ԧ
𝑦Ԧ

SAP API Business Hub: https://api.sap.com/api/similarity_scoring_api

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 8


Ready-to-Use Functional Services
Combining machine learning services

Product Catalog Images Image Feature Extraction Feature Vectors DB


01011
11011
11011
01011
01110
11010
10011
10110
Result

Image Feature Extraction Similarity Scoring

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 9


Ready-to-Use Functional Services
Multi-Instance Image Segmentation
The Multi-Instance Image Segmentation service localizes and segments objects in natural images

SAP Leonardo
Machine Learning

▪ Classes that are supported currently include various common forms of packaging used in retail stores like
bottles, cans, tetra-packs and squeeze tubes.
▪ Returns the coordinates of the bounding box and a corresponding pixel-wise segmentation mask for each
instance of the detected and identified objects in the image.
▪ Addresses common business problems in consumer product and retail industries like planogram
compliance, stock counting and out-of-stock detection.

Documentation:
https://help.sap.com/viewer/product/SAP_LEONARDO_MACHINE_LEARNING_FOUNDATION/1.0/en-US
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 10
Ready-to-Use Functional Services
Optical character recognition

The Optical Character Recognition service takes an uploaded image and returns the text
characters detected

SAP Leonardo
Machine Learning

API Business Hub: https://api.sap.com/api/ocr_api/resource

Remark: When the formats from which the text has to be read are documents or print media scans, the OCR
service should be used whereas in case of natural images (e.g. reading the counter of a utility meter or the
number-plate of an automobile from a security camera feed), the Scene Text Recognition service should be
used

Documentation:
https://help.sap.com/viewer/product/SAP_LEONARDO_MACHINE_LEARNING_FOUNDATION/1.0/en-US
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 11
Ready-to-Use Functional Services
Scene text recognition
The Scene Text Recognition service localizes and reads text from natural images and scenes
{
"bboxAccuracy": 0.9999,
"boundingBox": {
"x1":
{ 766, "y1": 102,
"x2":"bboxAccuracy":
852, "y2": 104, 0.9999,
"x3":"boundingBox":
851, "y3": 137, {
"x4": 765,
"x1":"y4":
766,136},
"y1": 102,
"text": “SAP Leonardo
"x2": Center"
852, "y2": 104,

SAP Leonardo } "x3": 851, "y3": 137,


"x4": 765, "y4": 136},

Machine Learning }
"text": “Paris, 21-06-2017"

▪ Detects individual texts, and outputs those as character strings along with their location within the
image
▪ Compared to Optical Character Recognition service, the Scene Text Recognition service offers
• Works with real-life color images
• Ability to work with font-less text
• Extract word-art/picturized text
• Works in different orientations of texts
• Text occurring in natural images like low-contrast, emboss/engrave

Documentation:
https://help.sap.com/viewer/product/SAP_LEONARDO_MACHINE_LEARNING_FOUNDATION/1.0/en-US
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 12
Ready-to-Use Functional Services
Face detection
The Face Detection service is a functional service for detecting faces in an image

▪ Outputs are bounding box coordinates of faces present in the image

SAP Leonardo
Machine Learning

Documentation:
https://help.sap.com/viewer/product/SAP_LEONARDO_MACHINE_LEARNING_FOUNDATION/1.0/en-US

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 13


Ready-to-Use Functional Services
Face feature extraction
The Face Feature Extraction service detects faces in an image and extracts feature vectors from
the detected face regions

▪ Outputs are bounding box coordinates of faces present in the image and the feature vector corresponding
to each face region

▪ These feature vectors can be compared to find similar / identical faces in different pictures

0.042
= −0.053
𝑣Ԧ ⋮
SAP Leonardo 0,078
Machine Learning

Documentation:
https://help.sap.com/viewer/product/SAP_LEONARDO_MACHINE_LEARNING_FOUNDATION/1.0/en-US

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 14


Ready-to-Use Functional Services
Machine learning services portfolio

Image Speech Text

Image Processing APIs

User Speech Processing APIs

Speech-to-Text
How can I convert speech to written Text-to-Speech
text and vice versa?

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 15


Ready-to-Use Functional Services
Machine learning services portfolio

Image Speech Text

User Text Processing APIs

How can I classify or match text Customizable text classification


contents? Text feature extraction

What are the key words and topics of Topic detection


text documents? Language detection
Translation
Customizable similarity scoring*

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 16


Ready-to-Use Functional Services
Language detection

The Language Detection service provides the ability to detect the language of any given string of
text data.

The quick
brown fox
English
jumps over SAP Leonardo
the lazy dog Machine Learning

SAP API Business Hub: https://api.sap.com/api/language_detection_api/resource

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 17


Ready-to-Use Functional Services
Machine translation API

The Machine Translation service provides the ability to translate text in a given language into
multiple target languages.

SAP研究院主要任务是 The main task of the SAP Research


研发改进SAP的核心产 Institution is to improve SAP’s
core products. SAP 4 main research
品。SAP的4个主要的研 SAP Leonardo institutions in Germany, India,
究院位于德国,印度, Machine Learning China and United States.
中国和美国.
Source Language: zh
Target Language: en

SAP API Business Hub: https://api.sap.com/api/translation_api/resource

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 18


Ready-to-Use Functional Services
Topic detection

The Topic Detection service extracts topics from documents and scores them according to the most
relevant topics.

Input: Zip file containing text files Output per document:


Topics containing keywords
that describe the content
SAP Leonardo
Machine Learning

SAP API Business Hub: https://api.sap.com/api/topic_detection_api

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 19


Ready-to-Use Functional Services
Topic detection

Requires three parameters: numTopics, numKeywordsperTopic and numTopicsPerDoc.


Keywords are words.
A topic is a list of numKeywordsperTopic keywords.
The algorithm creates numTopics topics.
For every document, the best-matching numTopicsPerDoc topics are calculated.

Input Articles:
Output (encoded as JSON): Topics:
Pizza recipe 0: [ cheesecake, dough, pizza,… ]

numTopicsPerDoc
Cheesecake recipe 1: [ ice, antarctica, study,… ]
Ice melt Score Matrix
Topic Pizza recipe Cheesecake Ice melt
numTopics = 2 0 0.71 0.71 0
numKeywordsperTopic = 15
numTopicsPerDoc = 2 1 0 0.0009 1.01

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 20


Ready-to-Use Functional Services
Document feature extraction

The Document Feature Extraction service transforms texts into abstract features that encode the
information content present in the document.

0.042
= −0.053
SAP Leonardo 𝑣2 ⋮
Machine Learning
0,078

SAP API Business Hub: https://api.sap.com/api/document_feature_extraction_api

These features can be used for multiple purposes:


▪ To implement content-aware document search
▪ To perform text clustering
▪ As input for a custom classification model (a shallow model, such as a logistic/softmax regression, an SVM,
a small neural network, or even a k-NN classifier)
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 21
Ready-to-Use Functional Services
Document feature extraction

1. NY Times G20 2. Washington 3. Fox News G20 4. Washington Post 5. Time Putin &
Post G20 Putin & Trump Trump

6. Cheesecake recipe 7. Pizza recipe 8. Twinkle, twinkle, little star


© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 22
Ready-to-Use Functional Services
Document feature extraction

G20 G20 vs Putin & Trump Newspaper vs Recipes NP vs Song

1. NY Times G20 1 2 3 4 5 6 7 8

2. WP G20 1 .976 .975 .932 .940 .792 .771 .569

3. Fox News G20 2 .976 .950 .953 .778 .764 .560


4. WP Trump & Putin 3 .923 .929 .754 .743 .534
5. Time Trump & Putin 4 .981 .767 .745 .544
6. Cheesecake 5 .768 .746 .557
Putin & Trump
7. Pizza
6 .959 .658
8. Twinkle, twinkle, little star
7 Recipes .654

Recipes vs
Song

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 23


Ready-to-Use Functional Services
Classification of text documents

For a new document, compute the closest


group (via similarity scoring) and assign the “G20 summit”
“Putin&Trump”
group’s classification to that article.

Business use cases could be:


▪ Knowledge base article classification
▪ Classification of service tickets

“Lullaby”

“Recipe”
© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 24
Ready-to-Use Functional Services
Coming up next

▪ Discuss how to consume services available on SAP


Leonardo Machine Learning foundation
▪ Learn about how to use SAP Leonardo Machine
Learning foundation models and services
▪ Learn when to use the trial Cloud Foundry and when
to use productive Cloud Foundry
▪ Get an overview of SAP Cloud Platform

© 2018 SAP SE or an SAP affiliate company. All rights reserved. ǀ PUBLIC 25


Thank you.
Contact information:

open@sap.com
Follow all of SAP

www.sap.com/contactsap

© 2018 SAP SE or an SAP affiliate company. All rights reserved.


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 platforms, 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 www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.