skip to Main Content

SAP Leonardo Machine Learning Trial

After all the buzz about SAP Leonardo last week at Sapphire, I thought I would take the new Machine Learning micro services for a spin.

If you navigate through the Leonardo page for ML, you will get a link to the API Hub, where you can see the available functional services:

  • Time Series Changepoint Detection
  • Document Feature Extraction
  • Image Classification
  • Image Feature Extraction
  • Product Image Classification
  • Product Text Classification
  • Similarity Scoring
  • Time Series Forecast
  • Topic Detection
  • Translation

Image Classification seems like an easy enough first trial.

If you click on that and review the overview tab, it says somewhat briefly:

Image Classification API calculates and returns a list of classifications along with their probabilities for a given image.

Clicking on the resource tab, you can review the operations. The only one here is POST. If you are logged in, you can simply go to the input parameters and try it out by choosing a file!

Let’s see if it can match my Golden Doodle, Chloey?

Return

{
"_id": "9101f024-5c75-4d23-9207-8644775a2610",
"predictions": [
{
"name": "chloey2.png",
"results": [
{
"label": "Bouvier des Flandres",
"score": 0.340883
},
{
"label": "Irish water spaniel",
"score": 0.189743
},
{
"label": "miniature poodle",
"score": 0.142425
},
{
"label": "standard poodle",
"score": 0.094428
},
{
"label": "Kerry blue terrier",
"score": 0.085941
}
] }
],
"processed_time": "Fri, 26 May 2017 20:21:35 GMT",
"request": {
"files": [
"chloey2.png"
],
"options": {},
"tenantName": "imgclassif-tech-user",
"texts": [] },
"status": "DONE",
"tenantName": "imgclassif-tech-user"
}

Nice! I had to Google ‘Bouvier des Flandres’, but it is a near match. Water Spaniels and Poodles are also very close.

You can also click on the Generate Code button, and choose code snippets in Javascript, Java, Swift (for the new Apple SDK Partnership), Curl, or ABAP.

We’ll use the Swift snippet, and in V.2 of this blog, we’ll combine with the iOS SDK for SCP and take photos in an app and do automatic matches on them.

But a logical next step is to get the API Key and try this out from POSTman (a REST test tool).

Go ahead and use the code snippet details to know what to put into POSTman. I create a POST request, se the Accept Header, and insert the APIKey.

You can get an API Key here:

Switch over to the body tab and input ‘files’ param like this:

Finally — click send and you will see your results!

Wow, seems to work! I’ll try a few more and report back.

Back To Top