#CustomVision – Analyzing images using PostMan from a #CustomVision project hosted in a #Docker Container

Hi !

Today’s post is a simple one that I’ll use for sure in the future:

How to make an HTTP Post Request using Postman to analyze an image using a Custom Vision project hosted in a docker container.

In my previous posts I share the necessary steps to export a CustomVision.ai project and run the project in docker. I also show how to send images for analysis from a .NetCore Console App.

Today I’ll use another popular tool to perform the Http call to the docker container: Postman. This is one of the most popular tools in the web development world, and for sure is a good one if even myself knows how to use it!

So, once we have our session in Postman the container URL and POST are very straightforward. We are going to send an image, so we need to add a header with the Content-Type as image/jpg.

01 postman header image jpg

The image will be sent as binary content in the body. With 2 clicks we can select the file to use for testing.

02 postman body raw file

And finally, the result is an amazing JSON that we can analyze and see how our model performs

03 postman json results

And as a bonus, once we have a test defined in PostMan, we can easily export the test as code in different programming languages like C#, Java, Go or Python.

04 postman generate code

Here is a sample of the generated python code


import http.client
conn = http.client.HTTPConnection("127,0,0,1")
headers = {
'Content-Type': "image/jpg",
'cache-control': "no-cache",
'Postman-Token': "847d04a8-0d05-4637-a056-7dbbdf10009b"
}
conn.request("POST", "image", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

19 comments

  1. Hi-
    I’m trying to use Postman with Azure Custom Vision Image classification count the parts in an image based on tags. I need some help with that. Can you assist?

    Like

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: