https://github.com/epomatti/azure-customvision-classification
Training & Prediction with Azure Cognitive Services Custom Vision.
https://github.com/epomatti/azure-customvision-classification
azure cognitive-services computer-vision custom-vision machine-learning nodejs typescript
Last synced: 4 months ago
JSON representation
Training & Prediction with Azure Cognitive Services Custom Vision.
- Host: GitHub
- URL: https://github.com/epomatti/azure-customvision-classification
- Owner: epomatti
- License: mit
- Created: 2020-07-31T21:55:55.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T01:16:10.000Z (over 3 years ago)
- Last Synced: 2025-03-11T02:51:19.375Z (7 months ago)
- Topics: azure, cognitive-services, computer-vision, custom-vision, machine-learning, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 1.77 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure Custom Vision Benchmark
Automated programs for training and prediction tasks using Azure Custom Vision (Cognitive Services).
## Infrastructure
Create the Cognitive Services resource:
```sh
az cognitiveservices account create -n '' -g '' --kind CognitiveServices --sku S0 -l 'eastus2' --yes
```For Cognitive Services --sku F0 tier is no longer available.
## Project Setup
Start by copying the sample `.env`:
```sh
cp example.env .env
```Go to [customvision.ai](https://www.customvision.ai/projects#/settings) resources and copy the folling parameters:
đĄ I've opened [#14595](https://github.com/Azure/azure-cli/issues/14595) to get the API Key using the CLI.
Now add the values to the `.env` file:
```sh
customVisionTrainingKey=''
customVisionTrainingEndPoint=''
predictionResourceId=''
```âšī¸ _Custom Vision recommends at least 50 images per set to ensure model performance.
Following the rule of thumb 70/30 you should have at least 15 additional images for the prediction tests._Set the remaining configuration for your project:
```sh
# Project
projectName=''
publishName=''# Sample data
trainingSampleDataRoot=''
predictionSampleDataRoot=''# Tags separated by commas
tags='tag1,tag2,tag3'
```The `tags` must match the directories for each image set.
Example:
Your data sample must match this directory structure.
## Training and Prediction
If you haven't already, download the dependencies:
```sh
yarn install
```First you need to create your project and tags:
```sh
# This will output the project id
ts-node src/createProject.ts
```Add the project ID to the `.env` file:
```sh
projectId='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
```Run the model scripts:
```sh
# Upload the images
ts-node src/upload.ts# Train the model
ts-node src/training.ts# Run the prediction tests
ts-node src/prediction.ts
```_My upload algorithm is limited to send a single batch of 64 images. Help me with a pull request_ đ
âšī¸ You must unpublish previous iterations on the Performance tab at [customvision.ai](https://www.customvision.ai) if you wish to publish new ones.
You'll get an output for each image according to it's associated tag:
```
Results for [husky]:
husky: 100.00%
border_collie: 0.00%
Results for [border_collie]:
border_collie: 100.00%
husky: 0.00%
```You may go to the portal now and see the results:
## References
[Custom Vision with SDK](https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?pivots=programming-language-javascript)
[Custom Vision Service Limits and Quotas](https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/limits-and-quotas)