SAP Leonardo Machine Learning Foundation

Explore Eursap’s top SAP roles. Secure your next SAP job with Eursap – Don’t delay! Apply today!


The objective of this Blog article is to provide an overview of SAP Leonardo Machine Learning Foundation. This may be helpful for Developers aspiring to update themselves with ML as well as Functional consultants and architects looking at using ML to build “Intelligent Processes”. The aspiration of many in management is to build an “Intelligent Enterprise”, to beat the competition and gain a higher market share of their products and services. SAP is helping its customers to achieve this, using SAP Leonardo Intelligent Technologies. It is also explained further in my blog post published a few weeks ago.

Exhibit -1. SAP Leonardo intelligent technologies (Credit: SAP SE)

Machine Learning Foundation (ML)

In simple terms, ML Foundation consists of “Functional Services” and “Core Capabilities”. These services and capabilities are exposed as consumable API for developers to build intelligent processes, by embedding them in their applications. The “Functional Service APIs” are categorised into three major groups namely: Image Related, Speech Related and Text Related. We will read more about them later in this article. Data Scientists, on the other hand, need capabilities such as “to train the existing models” or “retrain to customize existing models” or “build own models”. These are available via the “Core Capabilities” of the ML Foundation. Typically, an SAP S/4HANA system is connected to ML Foundation using Cloud Platform Connector or SAP Data Hub. This is shown pictorially in Exhibit-2 below.

The readily available ML Foundation services and capabilities help customers to try and implement the solutions within a short period of time.

Exhibit -2. SAP Leonardo ML Foundation (Credit: SAP SE)

Where Are The APIs?

The SAP Leonardo ML Foundation service portfolio is available in SAP API Hub. On this web page, choosing API (on left pane in the page) and clicking “more” on the resulting page will show the tile “SAP Leonardo Machine Learning Foundation – Functional Services”. Alternatively, jump to (Link: See Exhibit-3 below. Currently (Oct-2018), you will notice there are 23 APIs available here. Let’s look at some of those APIs, in the following paragraphs.

Exhibit -3. SAP API Business Hub (Credits: SAP SE)

Image Related Functional Service APIs

There are many Image related Functional Service APIs available in ML Foundation, to perform tasks such as detection of an object, classification of object, human detection, face detection, etc… in pictures. They can be customised for customer specific products as well. Let’s look at a sample few to understand the service better.

Image Classification Service

In Exhibit-4 below, a picture of a truck is fed to the API. The API (model behind it) was trained to recognize a certain class of objects (eg. trucks, vans, SUVs etc…). The “confidence value” between 0 (not confident) to 1(highest confidence) is also returned for each of the objects. The highest confidence value is used as the most probable result and developers can proceed accordingly. In this exhibit, it is identified as “a truck’ with a high confidence level (.7).

Exhibit-4 (Credits: SAP SE)

Image Feature Extraction Service

This service transforms the image into a list of abstract feature data vector. One can imagine this data vector to be a mathematical representation of the object present in the picture. Using this on a customer specific product, a developer could build a custom classification object and use it in other applications to identify the object. It would be better understood in the subsequent example.

Similarity Scoring Service

This service compares any two vectors belonging to two objects having the same dimensions. A value nearing one is considered closely similar.

Example Of Sample Application Using The Above Services:

Consider a customer sending a picture of a company’s damaged products and asking whether they could be repaired if sent by post. The company must know whether it is a product in their catalogue and, considering the damage, make a decision as to whether it could be repaired or not. This is a good example of how to build an “Intelligent Process” using ML services. Observe the Exhibit-5 below:
• The Company has extracted their product catalogue image vectors, using image feature extraction. Top 3 boxes show that sequence.
• The Customer has sent an image; after extracting image vectors, then a similarity scoring service is applied. The bottom 3 boxes show that sequence.
• The Result box is the object from product catalogue is identified.

Exhibit-5 (Credits: SAP SE)

Optical Character Recognition Service (OCR)

OCR service takes the uploaded file and returns the text characters detected in the input. Typical usage of this would be in reading legal documents and comparing them with another version. This service is available using the link

Scene Text Recognition Service

This service detects text present in natural images and scenes and extracts individual texts present in them. As an example, see the Exhibit-6 below. You can see the service has extracted “SAP Leonardo Center” and “Paris 21-06-2017”. This service works with font-less texts, word art, picturised texts, texts in different orientation, etc… The help documentation gives more info on this service.

Exhibit-6 (Credit: SAP SE)

Face Feature extraction service

This service detects faces and extracts feature vectors from the detected faces. See below the Exhibit-7. These feature vectors can be used to compare similar or identical faces in multiple pictures. It even works when the face is a side profile. You can play around to see how this and the similarity scoring service is able to identify images and have some fun!

Exhibit – 7 (Credit: SAP SE)

Speech Related Functional Service

There are two services planned to be released. The first one will convert Speech to Text. The second one will convert Text to Speech. One needs to wait until full documentation is released by SAP.

Text Related Functional Service

The following services are available:

Language detection.

Given a string of text, it has the ability to detect the language. This service can detect 94 languages of texts. You can find more information here:

Machine translation.

Translation can be done from single source language into multiple target languages. More info can be found here:

Topic Detection.

This service requires the input to be text files. It extracts topics from documents and scores them according to most relevant topics. More info can be found here:

How to use ML Foundation Services

To explore and get motivated, a cost-free first level hands-on Sandbox is available from the SAP API Hub. The links and examples given in this blog have used the same. In the Exhibit-8 below, you may observe that the API Environment shows as “Sandbox”. A developer may “try out” the API with sample images and see how the vectors are returned with values. A developer can also use the code snippet to generate code. Code can be generated for multiple Languages such as Java, JavaScript, Swift etc… The developer may also get an API Key and use it to invoke API services from his own development system programs. It is a great service for developers to explore and try hand-on developments without incurring cost.
SAP also provides a “Trial Cloud Foundry” and “Productive Cloud Foundry” for real world application testing and productive use. These require a Cloud Foundry Global account with ML Foundation service enablement.

Exhibit- 8 (Credit: SAP SE)

Exhibit – 9 (Credit: SAP SE)


ML Foundation is a great tool of ready to use services for any customer to explore. We are in the early stages of entering a new era by building “Intelligent enterprise”. Developers and Functional Consultants may like to enrol in the Open SAP course available on ML Foundation and also on ML Learning in a Nutshell. You can also review websites for SAP Machine Learning Overview, SAP ML Products and Developer Topics on ML for more info.

Wishing you all a happy learning experience!

Author : Ravi Srinivasan , SAP Alumni

Need to hire SAP resources?

Get in touch with Eursap – Europe’s Specialist SAP Recruitment Agency