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 responses to “#CustomVision – Analyzing images using PostMan from a #CustomVision project hosted in a #Docker Container”

  1. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  2. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  3. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  4. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  5. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  6. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  7. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  8. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  9. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  10. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  11. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  12. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  13. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  14. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  15. […] Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container […]

    Like

  16. Manish Sood Avatar
    Manish Sood

    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

    1. sure, share some context

      Like

Leave a reply to #Event – Resources used during the #GlobalAINight @metrotorontoUG – El Bruno Cancel reply

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading