An example of the Microsoft Custom Vision API, inspired by Silicon Valley
David M Smith (@revodavid), Developer Advocate at Microsoft
To run this script, you will need:
-
R. Any version of R later than R 3.4.0 should work.
-
A Microsoft account. You can use an existing Outlook 365 or Xbox Live account, or create a new one.
-
A Microsoft Azure subscription. If you don't already have an Azure subscription, you can visit https://cda.ms/kT and also get $200 in credits to use with paid services. You'll need to provide a credit or debit card, but everything we'll be doing is free to use. If you're a student, you can also register at https://cda.ms/kY without a credit card for a $100 credit.
You'll also need a few other things specific to this application. Follow the instructions below to set up everything you need.
- Visit https://portal.azure.com
- Sign in with your Microsoft Account. If you don't have a Microsoft account, use the links above to create one for free.
In Azure, a Resource Group is a collection of services you have created. It groups services together, and makes it easy to bulk-delete things later on. We'll create one for this lab.
- Visit https://portal.azure.com (and sign in if needed)
- Click "Resource Groups" in the left column
- Click "+ Add"
- Resource Group Name: nothotdog
- Subscription: there should be just one option
- Resource Group Location: South Central US
- Click "Create"
A notification will appear in the top right. Click the button "Pin to Dashboard" to pin this resource group to your home page in the Azure portal, as you'll be referring to it frequently.
- Visit https://portal.azure.com (and sign in if needed)
- Click "+ Create a Resource" (top-left corner)
- With the "Search the Marketplace" box, search for "Custom Vision Service"
- Select "Custom Vision Service (preview)" and click "Create"
- Name: nothotdog-customvision
- Subscription: there should be just one option
- Location: South Central US
- Prediction Pricing Tier: F0 (free, 2 transactions per second)
- Training pricing Tier: F0 (2 projects)
- Resource Group: Use existing "nothotdog" group
- Click "Create"
Download the file keys.txt
and provide the keys listed from the Azure Portal. For the first line
of the file, region
, leave as eastus
. For the remaining keys, visit your qcon
resource
group in the Azure Portal and then:
- Open the
keys.txt
file and change theregion
entry tosouthcentralus
- Visit https://portal.azure.com (and sign in if needed)
- Look at the resources in "Resources / NOTHOTDOG" on your dashboard. (If you don't see it, click on Resource Groups in the left menu)
- Click on the API resource for Custom Vision
nothotdog-customvision
- In the menu, click on "Keys"
- Click the "copy to clipboard" next to KEY 1. (You can ignore KEY 2).
- Paste the key into the
vision
entry inkeys.txt
- Return to your
nothotdog
resource group - Click on the API resource
nothotdogcustomvis_Prediction
- In the menu, click on "Keys"
- Click the "copy to clipboard" next to KEY 1. (You can ignore KEY 2).
- Paste the key into the
cvpred
entry inkeys.txt
Your final keys.txt
file will look like this, but with different (working) keys:
key
region southcentralus
custom 1632b49e2930430694a9bbd3ab0c0cc2
cvpred 37eb1f0e5fd34253939350197ae3d933
Open the R script nothotdog.R
to walk through the process of creating a custom vision application.
If you get stuck or just have other questions, please file an issue to this repo and I'll respond. You can also contact me here:
David Smith davidsmi@microsoft.com