Computer Vision using Python -
There are scenarios in which you might need to obtain from images like -
1) Tag visuals
2) Detect Objects in the image
3) Detecting brands
4) Categorize an image
5) Describe an image
6) Detect faces
7) Detect Image types
8) Detect Domain Specific content
9) Detect Color Scheme
10) Generate a thumbnail
11) Get Area of interest
This blog speaks about using computer vision service from Azure which helps you to describe the image which you can do it locally based on the example provided by Microsoft using Python. Given below are the steps to do this on windows 10 -
My Environment:
OS: Windows 10
Python Version: 3.7.4
Assuming you have a azure account. Else you can signup for 12 months free (https://azure.microsoft.com/en-in/free/)
Things might change when you are implementing as API's might be deprecated.
Actions on the Azure Portal -
Step 1 - Login into the portal and search for Cognitive Services and click on Add, you should be able to see the content as shown in the snapshot below -
There are scenarios in which you might need to obtain from images like -
1) Tag visuals
2) Detect Objects in the image
3) Detecting brands
4) Categorize an image
5) Describe an image
6) Detect faces
7) Detect Image types
8) Detect Domain Specific content
9) Detect Color Scheme
10) Generate a thumbnail
11) Get Area of interest
This blog speaks about using computer vision service from Azure which helps you to describe the image which you can do it locally based on the example provided by Microsoft using Python. Given below are the steps to do this on windows 10 -
My Environment:
OS: Windows 10
Python Version: 3.7.4
Assuming you have a azure account. Else you can signup for 12 months free (https://azure.microsoft.com/en-in/free/)
Things might change when you are implementing as API's might be deprecated.
Actions on the Azure Portal -
Step 1 - Login into the portal and search for Cognitive Services and click on Add, you should be able to see the content as shown in the snapshot below -
Step 2 - Search for computer vision and you should be able to see the service provided by Microsoft, click on create
Step 3 - Once you click you will be shown the image below, fillup the details and make sure to choose F0 for free trial if you have signed up for free account.
Step 4 - Once you create please make sure you note down the Key and Endpoint by clicking on Quick start as shown in the image below.
Once you have the two components lets start preparing the environment for running the code.
Actions on the workstation -
1) Install python on Windows 10: https://www.python.org/downloads/windows/
To validate the installation open command prompt and use the command python --version
I have used Python 3.7.4 for this.
2) Install below libraries -
matplotlib - pip install matplotlib
pillow - pip install pillow
3) Create two environment variables called COMPUTER_VISION_ENDPOINT, COMPUTER_VISION_SUBSCRIPTION_KEY on your machine with the values you got from Azure portal Step 4.
3) Use an image of your choice and place it in a path in your computer, in my case it is C:\Users\Bharathrs\Documents\Images\
4) Step 4, create a file call it imageanalysis.py and add the code below
Once it is done run the program using the command python
No comments:
Post a Comment