Hi and welcome to unit 10 of the openSAP course for SAP Data Intelligence for Enterprise AI.
In this unit we will have a deep dive into the intelligence services.
You have already seen this architectural view in unit two. The intelligence services are offered
either as business services or functional services. Before we dig deeper into functional services
let's refresh our memory on the business services. Business services are usually built on SAP- owned models.
At SAP we have a Deep Learning Center of Excellence, consisting of mainly data scientists
and also ML application teams who create, for instance, deep-learning models
for solving specific business problems. They are trained with SAP-owned labeled data.
Five out of six currently available business services can be re-trained with customer-specific data
to achieve optimal performance. Some business services even have to be re- trained
with customer-specific data. For example, in Service Ticket Intelligence, which we talked about
in unit two, different customers can have different categories
and different ticket types, and so Service Ticket Intelligence has to be re-trained with customer data.
This is one step during the implementation phase. The training data can be provided as .csv file
in this case, and can come from any SAP or non-SAP CRM system.
But now, let us concentrate on the functional services of SAP Data Intelligence in this unit.
In SAP Data Intelligence, you can connect to different data sources like SAP HANA
and non-HANA databases, Business Warehouse, SAP and non-SAP applications, IoT streaming data,
text data on images, and even X-data, the experience data from SAP Qualtrics.
This data can be used as input for the functional services. For calling the services within
an SAP Data Intelligence Pipeline, you have multiple different template pipelines,
depending on the type of input and output of the functional service to be invoked.
Within the template you have a Python operator where you can define your input for the service.
You also have the Functional Services operator, where you have a drop-down list in the configuration
for choosing the service of your choice. This operator is available to you
through the pipeline modeler. If the functional services do not fulfill your needs,
you can also train your own TensorFlow models, as shown in the previous units.
Functional services could be organized into three main categories,
based on the input type they receive. Image services, text services and numerical services.
Let's first focus on the functional services available to work with images.
Image classification, image feature extraction, and image OCR.
You can create, for instance, an image classification pipeline using the templates available to you in ML Scenario Manager.
Let's see a demo of this service. Here we can show object and text detection.
So, when I come to the Object and Text Recognition, this is SAP Leonardo AI services
where you can demo those capabilities. So I come to object and I choose
Object and Text Recognition, and I click on a live demo where it actually
can take me to the place where I can test a few things. So for instance, if I click on this person, this jockey
with the horse, you can run the service, and there, as you can see, for instance,
the bounding box here actually shows what we have recognized in this image
and found in this image. For instance, we say that we are 100% sure
that the object detection service has found the horse and the person,
and we're 100% confident in finding those objects. Also, as you can see, it recognizes the text
where it says AT, and we are 84% sure that this is the AT. So by using this service, you can embed these
as part of your business application, and build your data science scenario
on top of this Object and Text Recognition. Also, I can show you another service
which is available through the image recognition, and that is OCR versus Scene Text Recognition.
So if you click on that, then you will see the difference that the OCR and Scene Text Recognition have
when it comes to recognizing the text inside an image.
So I can browse to, for instance, bus image. This is an image that I have already prepared
and is available to you, and I use this live demo, live service, to show you how this works.
So as you can see, the Scene Text Recognition is taking more time, because it scans over the image
looking for every object in the image and all the text, while the OCR only looks
for the text in the image. So the result that it returned is actually faster.
So as you can see, it hasn't done really well in terms of recognizing the text in the image here,
but we have the same text recognition where it actually has done a real great job.
It took a little bit longer, compared to OCR, to run but actually, it found the words and the text
that are mentioned inside this image. For instance, Brixton, 159,
and then if I click on more, Oxford, and how much we are confident, for instance,
we're 95.8% confident that this is the text that we see in this image.
So, depending on your use case, you can use any of these services.
The image classification API calculates and returns a list of possible targets,
along with their probabilities for a given image. So let's try the image classification.
So if I click on the image classification service here, it will take me to the SAP API Business Hub,
where I can load, for instance, I can try this service. So I say I log in and I have access to this service.
So then I can say, okay so let me try this out, and then I can choose, for instance,
one image here, let's say I want to choose this one... Execute that.
And this is live, so as soon as you pass the object, it will actually try to classify that image for you.
Okay, so as you can see, it has actually classified that image as a trolley bus or a passenger car,
and these are the highest confidence that it has in classifying that image.
Or I can, for instance, choose another image and let's execute it.
And there, for instance, that was the image of a dog that I had, and then it classified the image
as a Kuvasz dog, or another guess was it could be a Labrador Retriever,
and it comes up with the breed of the dog for me. So you can embed this as part of your business application.
The image feature extraction is a very useful service when you work with images.
No matter what your goal is, if you want to detect faces or recognize objects, you need to extract some features
that can represent the images. Instead of writing an image feature extraction from scratch,
you can use the Leonardo AI feature extraction service. Let's look at this service,
which is available through the SAP API Business Hub. As we mentioned, this service will translate your image
to a numerical vector, which can then be used for image search, image clustering, or custom classification
for shallow models such as SVM, K nearest neighbor, and so on.
So let's look at how it works. So again, I come to the SAP API Business Hub,
and I choose an image, let's say, for instance, an image that I have already saved,
and then I execute this. As you can see, it has created a feature vector for me,
which then can be used in order to recognize that image for the training or serving.
Another service is the image OCR. The OCR service is very useful
when you have paper forms or documents which you want to digitize and process further.
Let's look at the OCR service, which is also available on the SAP API Business Hub.
This service is highly customizable. You can pass parameters to define the output format,
define the source language, or pageSegMode, such as the orientation of the text, and so on.
So I would like to try this out, so I can come here and say, OCR,
I have a text that I want to digitize, and once I add this, I can execute it.
And then it will show me the content of my document. So for instance here, I can see that it is digitized
and it is talking about, did you know that you can use your SAP Leonardo Machine Learning functional services
and so on and so forth, giving me more information. So I can use this as a first step
of reading from my paper documents, to add to my business scenario.
For instance, when I turn them into some .csv files, then I can run my algorithms on top of that.
Now, let's take a look at the text services. Text classification.
The text classification service classifies products into categories,
based on their textual description. It is capable of recognizing products
from 50 different categories. As input, descriptions are provided
and the response returns five sorted categories with the largest probability or likelihood.
Let's test this service. So I can enter a text, for instance,
I like the design of this case. And then I will execute it.
This is the result of the text classification, where it tells me that, for instance,
this comment is related to a mobile phone case, which is absolutely correct, and it also has the score,
how confident is my system in returning that classification. For instance, 96%.
Or, for instance, the mounting kits or the tablet cases, and the confidence
is a little bit lower, in this case. Another text service is the topic detection
that extracts topics from documents, and assigns the documents to the most relevant topic
according to the topic scores. The Topic Detection service is highly customizable,
because it is automatically trained with the document corpus, which you send
to the service as a zip file. The process for extracting topics is as follows.
The documents provided by the user are pre- processed to remove stop words and punctuation.
The words are then tokenized and converted to lowercase. Vectorization of the documents is performed
with inverse term frequency. The non-negative matrix factorization method
is applied, to cluster the terms into topics. The number of terms extracted from the documents
are the number of topics which are specified by the user. The same documents are then assigned
to the most relevant topics, based on the topic score. This topic score is calculated by the distance
between the topic and the document vector. Last but not least, the translation service is trained
with SAP-specific texts, so it is particularly strong in SAP-related texts.
One advantage of using SAP's translation service is that your data is not sent to a translation service
in the Internet, which might be misused. If you, for example, have sensitive contract information,
you do not want to send it to a service which consumes your data for the improvement
of their own services. We also offer the similarity scoring service
for numerical values. It means that you can use
the similarity scoring to compare two different vectors of the same dimension.
These could, for example, be image feature vectors or document feature vectors.
We use the cosine similarity as the metric here. As we mentioned before, functional services are available
out of the box as template pipelines. Let's look at a demo together.
So as you can see, I can go to my ML Scenario Manager and create a new scenario.
Let's say that I want to use the machine translation service.
So I call it Machine Translation and I create that.
Then, I go to my Pipelines section and I can create a pipeline here.
Call it, let's say again, Machine Translation Pipeline. Then, I define a template here which is called Translation.
I use that template, and by creating that, it will take me to my pipeline modeler.
As you can see, using a template, it creates the whole pipeline for me.
Then if I open my Python script, I can see the parameters that I can actually
pass to that, in order to run that pipeline. For instance, the source language or the target language,
for instance, English and German in this case, and, for instance, for the Functional Services operator,
I can use the dropdown menu to define the type of service that I want to use.
Because I chose the translation template, it already has that service as defined,
so I don't need to choose that. Then, when I run this pipeline,
I can go to the terminal and enter, for instance, the text that I want to translate.
[In this example the text is stored in the Python operator for demo purposes as shown before.] Once my pipeline is running, I can open a terminal,
and look at the result. Okay, so as you can see here, for instance,
I had some document, for instance in German, and I translated that into English.
I can use the OpenAPI servflow or OpenAPI client, in order to consume that service
as a REST API in my business application. Here we have a use case which receives images as input.
Imagine you are walking in a city and see a nice car which you like.
You want to get more information about it but do not know which model it is exactly.
Therefore, our customer Daimler created an app where you just take a photo of your dream car,
and the app gives you more details about the model, the name of the car, color, and the rim type.
So, from a business perspective, this app can accelerate the conversion
in the car sales process in early stages, and leads you to an improved customer experience.
In the next slide, you see how this was implemented technically.
The app uses four different deep learning models, which have been developed
or re-trained customer-specifically. The first step is an image object detection step,
which identifies all cars in the image. If there is more than one car found,
the largest car in the image is selected, and only the bounding box with the car inside
is used for the next steps. Here parallelism capabilities
of SAP Data Intelligence are used, and all three following steps are executed in parallel.
One step is the image classification, based on the re-trained image classification service.
In this case an A-Class model 2013-2018 is detected. Another step is the car color prediction,
where first a pixel-wise mask of the car boundaries is calculated,
and only the pixels within this mask are used as input for a deep learning model, which has been trained
with many Daimler car images with different colors. The result is a car color prediction.
The third of the three steps running in parallel is the rim type detection.
It first finds the rims in the image, and then classifies them.
So, this use case is a good example, where you see that many steps have to be executed subsequently
and in parallel, and the pipeline engine of SAP Data Intelligence can cover the entire process well.
Now I will show you a prototype app in a live demo. Here I have the prototype of what Daimler,
our customer, has developed for the car model detection. So first, I want to take a picture.
Let's say this is the picture of the car I have taken walking around in the street,
and running this, it will simply show me what is the brand of this car, Mercedes,
for instance, the model is A-Class, and the color of the car and the rims, the wheels,
this is the type of it. So I can edit it, if the prediction is wrong,
and that way, I can send feedback to the system, where it can actually correct and improve my system.
Hope you enjoyed this session. In this unit, you learned about Leonardo AI services
and how to use them with SAP Data Intelligence. In the next unit, we will summarize our learnings
and introduce you to more resources for further learnings on SAP Data Intelligence.
Good luck with your self-assessment quiz.