Skip to content

Latest commit

 

History

History
95 lines (51 loc) · 3.56 KB

DEMO ONNX deployment.md

File metadata and controls

95 lines (51 loc) · 3.56 KB

DEMO: ONNX Deployment

💡 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.

Load the simple ONNX model

(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".

  1. In the Azure Portal, visit your aiml20-demo resource group

  2. Click the "aiml20" App Service resource

  3. In the left menu under Development Tools, Click Advanced tools, then click "Go" in right pane to launch Kudu.

  4. In the main menu bar, Click Debug Console > PowerShell

  5. Browse to: site / wwwroot / Standalone / Onnxmodels

  6. With Explorer, open the ONNX / simple model folder from your AIML20 repo

  7. 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.

  8. 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.

Defining the problem: Shop by Photo doesn't work right

(Note: This section was done at the beginning of the AIML20 presentation.)

  1. Visit the Tailwind Traders website you deployed earlier.

  2. Scroll down to the "Shop by Photo" section of the website

  3. Click "Shop by Photo"

  4. In your AIML20 repo, select: test images > drill.jpg

  5. It correctly identifies it as a drill. Yay!

  6. Return to home page and click "Shop by Photo" again

  7. In your AIML20 repo, select: test images > pliers.jpg

  8. Oh no! It identifies it as a hammer. We'll fix that later, but first, let's understand why it failed.

Update the ONNX model in the Tailwind Traders website

First, view the exported model in Netron:

  1. Browse to https://lutzroeder.github.io/netron/, Click Open Model

  2. Open ONNX / Custom Model / products.onnx

  3. 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

  1. In the Azure Portal, visit your aiml20-demo resource group

  2. Click the "aiml20" Web App resource

  3. Under Development Tools, Click Advanced tools, then click "Go" in right pane to launch Kudu.

  4. In the main menu bar, Click Debug Console > PowerShell

  5. Browse to: site / wwwroot / Standalone / Onnxmodels

  6. With Explorer, open the ONNX / custom model folder from your AIML20 repo

  7. 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".)

  8. 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!

Next Step

Personalizer