Skip to Content

Use the Image Classification API from a REST Client

test
0 %
Use the Image Classification API from a REST Client
Details
// Explore More Tutorials

Use the Image Classification API from a REST Client

03/22/2019

Discover how to call the Image Classification API from a REST Client like Postman

You will learn

  • Call an API from a REST client like Postman
  • The basics about Machine Learning Foundation Service for Image Classification

Step 1: The Image Classification Service

The Image Classification service calculates and returns a list of classifications along with their probabilities for a given image. It extracts feature vectors for any given image for comparison, information retrieval, clustering, or further processing.

This is the list of accepted file extensions:

Name Description
Archive file zip, tar, gz, tgz
Image file jpg, jpe, jpeg, png, gif, bmp

The images should be RGB, or 8-bit gray scale.

If an archive file is provided, no additional files can be provided.

The input file (or the archive file) is provided using form data (as an element named files in the form data).

The service will return a JSON response that includes the top classification with the associated scores.

For more details, you can check the following link:

Log on to answer question
Step 2: Call the API

Open a new tab in Postman.

Make sure that the my-ml-foundation environment is selected.

On the Authorization tab, select Bearer Token, then enter {{OAuthToken}} as value.

Postman

Note:: the OAuthToken environment variable can be retrieved following the Get your OAuth Access Token using a REST Client tutorial.

Fill in the following additional information:

Field Name Value
HTTP Method POST
URL the value for IMAGE_CLASSIFICATION_URL in your service key

Note As a reminder, the URL depends on you Cloud Platform landscape region but for the trial landscape only Europe (Frankfurt) provide access to the Machine Learning Foundation services.

On the Body tab, keep form-data selected. Add a new key named files and switch it to File instead of Text (default).

Select your image file.

Postman

If you are missing some inspiration, you can use Google Search to search for duck images.

Click on Send.

You should receive a response that includes a series of predictions entries for each input files:

Postman
{
    "label": "drake",
    "score": 0.9270621538162231
}
Log on to answer question
Step 3: Validate your results

Provide an answer to the question below then click on Validate.

Paste the full response returned by the request.
×

Next Steps

Back to top