Task 3.2.1 - Set up Cognitive Services Custom Vision Service to Recognize People Wearing Knowzy Products
Our marketing department wants to let users capture pictures of themselves wearing Knowzy products to share with their friends. Knowzy can use this information to automatically detect what products are being worn and determine the user's excitement for each of the products. This information can be used to drive improvements to those products.
Goals for this task: Enable your Android and UWP app to use a Cognitive Services Custom Vision service to detect Knowzy products and the user's emotion from a captured image.
- This task has a dependency on Task 3.1.3 and all of it's prerequisites.
- A Microsoft Account
- In your web browser, navigate to https://customvision.ai
- Click the Sign In button and enter your Microsoft Account credentials.
- Create a new Custom Vision project by clicking the New Project tile
- Enter a name for the project (you will need to remember this later), and select General for the domain
- Click the Create Project button to create the new Custom Vision project
- Click the Settings button and copy both the Training Key and Prediction Key values - these will be required later
In order for the Custom Vision Service to detect which Knowzy products appear in images submitted by the app, it must first be trained. Training the service requires uploading a small set of images with people wearing Knowzy products in a diverse set of lighting, zooming and other conditions. Each image is tagged to tell the service what classification the image represents. Once the service has sufficient training images, it will then be able to classify other images (that are not part of the training set) based on matching characteristics.
Because you need between 10-20 images per tag to successfully train the service, we have provided a set of images that are ready to be ingested and tagged. We have also provided a tool which is able to ingest the training images directly from an Azure Storage blob account (this will save needing to upload the images). The training images are organized into separate containers for each tag.
-
You must first build the training tool. Open the solution at
\src\Tools\Tools.slnin Visual Studio 2017. If you didn't go through the other tasks make sure you go to the git repo https://github.com/Knowzy/KnowzyInternalApps and clone or download the content onto your local computer first. -
Build the solution
-
Open a command prompt and navigate to the location where Visual Studio output the built
CustomVisionTrainer.exe. This issrc\Tools\CustomVisionTrainer\bin\Debug. -
Run the
CustomVisionTrainer.exetool to upload training images for the three different Knowzy products. The tool requires you to specify the Training Key and Project Name of your Custom Vision Service project and the name of the project:CustomVisionTrainer.exe {Training Key} {Project Name} https://bthackcustomvisiontrain.blob.core.windows.net/knowzy8s Knowzy8s CustomVisionTrainer.exe {Training Key} {Project Name} https://bthackcustomvisiontrain.blob.core.windows.net/knowzyvr KnowzyVR CustomVisionTrainer.exe {Training Key} {Project Name} https://bthackcustomvisiontrain.blob.core.windows.net/knowzybowzy KnowzyBowzy
- Switch back to the Custom Vision portal in your web browser.
- On the Training Images tab, verify that the images you just uploaded using the tool are correctly displayed and tagged. Note: There may be a delay of up to 3 minutes for the images to appear.
- Click the Train button. This will display progress and the training images are processed and the model is constructed. The process should take less than 2 minutes.
- Click on the Performance tab. Verify that a new Iteration has been created after the training has completed. Select the latest iteration and click the Prediction URL button. Copy the URL under the If you have an image file heading. This URL will need to be substituted into our code file later on when you integrate calling this service into our Xamarin application.
Go to the next Task where you'll create a Cognitive Services Emotion API to detect the level of excitement of a user.