This is to use Azure Cognitive Services to get an image dataset and train a Custom Vision model. The repository has a simple nodejs console app that uses Bing Image Search to scrape images to a local directory based on search term(s). Then use the images scraped to create a Custom Vision model with Azure Cognitive Services.
Click here to create your account
- Go to portal.azure.com
- Select "Create Resource"
- Select "AI + Machine Learning"
- Select "Bing Search v7"
- Complete the required fields
- Select "Create"
- When the deployment succeeds you will get a notification in the top right corner.
- Select "Go to resource"
- Select "Keys" from the left hand navigation for the resource.
- Copy the Subscription Key and paste it into the script.
Clone the repo
https://github.com/coderganesh/yogaclassifier.git
cd YogaClassifier-master
Install packages
npm install
Open in VS Code
code .
Add the key into the app.js script
const subscriptionKey = 'addyourkeyhere'
Run the script
node app.js
- Go to portal.azure.com
- Select "Create Resource"
- Search "Custom Vision"
- Select "Create"
- Complete the required fields
- Select "Create"
- When the deployment succeeds you will get a notification in the top right corner.
- Select "Go to resource"
- Select "Quick Start"
- Select "Custom Vision Portal"
- Select 'Sign in"
- Select "New Project"
- Enter a Name and Resource Group and
- Project Types: Classification
- Classification Types: MultiClass General
- Domains: General
- Create project
- Add and tag images
- Select "Add Images" and navigate to the train folder for the scraped images
- Ctrl + A to select all the images in the folder
- Select "Open"
- Add tag for photos to indicate the yoga pose
- Select "Upload photos"
- Repeat these steps for each yoga pose (class)
- Select "Train"
- Test your model
- Select "Quick Test" from the upper right corner
- Browse to local files and select a image from the test folder
- The predication will appear on the right side of the window
- Select "Performace" from the top navigation in the Custom Vision portal
- Select "Prediction Url"
- Copy the Url to either use an image url or image file
- Additionally by selecting the settings icon in the right corner will bring you to the keys and urls to call the endpoint.
Once the model is trained and at a satisfactory accuracy its ready to be used in your App
- Go to the Resource Group that contains the Custom Vision Resource
- There should be a resource named "YourCustomVisionResourceName_Prediction - Quick start"
- The Select "Api Reference" from the list of helpful links
- This will open a page with docs on how to call the api to get predictions from the model
- If you scroll all the way to the bottom there are code samples in multiple languages to get you started
- Get the predction url as described above
- Select "Post" from the dropdown and paste in the url
- Go to the settings and get the Prediction Key
- In the headers add the
Prediction-key
as the key and the actual key as the value - Auth should be set to no auth
- Select Body > Raw > Json
- Paste in the following Json
{ "Url": "UrlForImageGoesHere" }
- Send Request
Quickstart: Search for images with the Bing Image Search SDK for Node.js
Quickstart: Create an image classification project with the Custom Vision Node.js SDK
Cognitive Service Bing Search Docs