💡 You must have completed the setup before attempting to do the demo.
In this demo, we take the ONNX file we exported in the Custom Vision demo, and deploy it to the Tailwind Traders website.
The website uses the model in products.onnx
for the Shop by Photo app. The
uploaded image is processed by the model, which generates one of five labels:
"hammer", "drill", "pliers", "screwdriver" or "hard hat". The website searches
the product list for the generated label, and returns the results of the search.
(TIP: You can do this step ahead of time. This step is necessary if you have run this demo before on the same deployment.)
We will replace the products.onnx file in the Web app with a version that only recognizes two object categories: "hammer" and "drill".
-
In the Azure Portal, visit your aiml20-demo resource group
-
Click the "aiml20" App Service resource
-
In the left menu under Development Tools, Click Advanced tools, then click "Go" in right pane to launch Kudu.
-
In the main menu bar, Click Debug Console > PowerShell
-
Browse to: site / wwwroot / Standalone / Onnxmodels
-
With Explorer, open the
ONNX / simple model
folder from your AIML20 repo -
Drag products.onnx into the LEFT HALF of the Kudu window. (IMPORTANT: Do NOT drag into the box that says "drag here to upload and unzip".) This model only knows how to identify drills and hammers.
-
Restart the web server. Return to the "aiml20" App Service resource and click "Restart" in the top menu bar. Wait two minutes for the website to restart completely.
(Note: This section was done at the beginning of the AIML20 presentation.)
-
Visit the Tailwind Traders website you deployed earlier.
-
Scroll down to the "Shop by Photo" section of the website
-
Click "Shop by Photo"
-
In your AIML20 repo, select: test images > drill.jpg
-
It correctly identifies it as a drill. Yay!
-
Return to home page and click "Shop by Photo" again
-
In your AIML20 repo, select: test images > pliers.jpg
-
Oh no! It identifies it as a hammer. We'll fix that later, but first, let's understand why it failed.
First, view the exported model in Netron:
-
Browse to https://lutzroeder.github.io/netron/, Click Open Model
-
Open ONNX / Custom Model / products.onnx
-
Scroll through the neural network and note:
- it's large
- at the top, is a 224x224 image as input (dirty secret: computer vision models have pretty poor vision)
- add the bottom, it outputs 5 values, these are the confidence scores for our class labels
Next, drop the ONNX file we exported into TWT filesystem
-
In the Azure Portal, visit your aiml20-demo resource group
-
Click the "aiml20" Web App resource
-
Under Development Tools, Click Advanced tools, then click "Go" in right pane to launch Kudu.
-
In the main menu bar, Click Debug Console > PowerShell
-
Browse to: site / wwwroot / Standalone / Onnxmodels
-
With Explorer, open the
ONNX / custom model
folder from your AIML20 repo -
Drag products.onnx into the LEFT HALF of the Kudu window. (IMPORTANT: Do NOT drag into the box that says "drag here to upload and unzip".)
-
Restart the web server. Return to the "onnx" Web App resource and click "Restart".
Rerun Shop by Photo, upload test images / pliers.jpg
. Now it works!