What's It Do?

The application consists of two components:

  • A Custom Vision Service project that allows you to build a custom image classifier to detect bacon in a photo.
  • An Azure Web App to display a web interface for users to submit photos.

Configuration

Create a Custom Vision Service account

  1. Navigate to customvision.ai.
  2. Click Sign in and log in with your Microsoft Account.

Create and train a Custom Vision project

  1. Click on New Project.

    • Provide a name for the project.

Select Food as the domain to optimize the model to work with plates of food.

  1. Obtain a variety of photos. To properly train your model, you need at least 30 photos that contain bacon, and 30 that do not. Download and separate the photos into two folders: bacon and not-bacon.

    Tip

    A good place to find photos is by doing an internet image search for breakfast. The list of images used in the training set for this article is here.

  2. Click on Add Images and select all the photos you previously downloaded in the bacon folder.

    • Create a tag named bacon and click + to add it.

Click Upload to upload the photos and tag them as bacon.

Click on Add Images again to add images from the not-bacon folder. This time, tag them as not-bacon.

Click Train to train the image classifier. When training is complete, your model is ready to use.

Click Quick Test to test your classifier. Find a photo that was not in your training set. Browse local files to upload it or enter its URL. Check that the model correctly predicted the tags for the photo.

Obtain Custom Vision Service API information

In order to configure the web application, you need some information about the Custom Vision Service project you created.

  1. Select the Performance tab in your project.

If you have trained your model more than once, select the latest iteration and click Make Default. The default REST API endpoint of your project is set to use this iteration of the model.

Click on Prediction URL. Under the "If you have an image URL" section, copy the API endpoint URL and the prediction key value for use in the next step.

Deploy to a Web App

  1. Click the Deploy to Azure link here or the button at the top of this page.
  2. If prompted, sign in to your Azure account.
  3. Enter the information for your new application, such as the resource group name, site name, etc.
  4. Fill in the Custom Vision API Key and Custom Vision API URL with the values that you previously copied.

  1. Click Next and then Deploy.

Test the web application

  1. If the application is successfully deployed, the Deploy to Azure tool displays a URL. Open the application by clicking on the link.
  2. Find a photo on the internet, paste its URL in the URL text box, and click Submit.
  3. The application should display whether or not bacon was detected in the photo.

How it works

The web application calls the Custom Vision Service REST API with the URL of the image to be analyzed in the body. Here is an example of the JSON response:

JSONCopy
{
"Id": "38d1249f-7153-4c2b-aa11-292bf9bd7085",
"Project": "736b29fa-0c84-4f3e-87ee-201012399fd7",
"Iteration": "d27e017e-c162-4c10-9610-19772d5e5049",
"Created": "2017-08-21T17:48:26.2785384Z",
"Predictions": [
{
"TagId": "017dab76-8630-4ef4-9cd0-46cec6b01655",
"Tag": "bacon",
"Probability": 0.845978856
},
{
"TagId": "bf9f817a-ed74-4bb3-8e9d-49f1b3b7a4bb",
"Tag": "no-bacon",
"Probability": 0.041467078
}
]
}

NotBacon的更多相关文章

随机推荐

  1. 【vue】vue-router路径无法正确跳转

    具体描述:vue项目,npm run build时点击路由切换,第一次点击没问题,再点不会切换报错如下图 原因分析:vue-router配置路由,当代码分割和懒加载时,由于webpack配置不当,导致 ...

  2. UVA10838 The Pawn Chess

    UVA好题没人写系列,感觉可以稍稍练习一下面向对象编程的形式(大雾) 题意很简单,在国际象棋的棋盘中有一些兵,走到对方底线即为胜利,问最优决策下谁能获胜.并输出最小步数. 首先这里的棋盘都只有\(4\ ...

  3. [Spark][Flume]Flume 启动例子

    Flume 启动例子: flume-ng agent --conf /etc/flume-ng/conf --conf-file /etc/flume-ng/conf/flume.conf --nam ...

  4. springcloud(十三):Eureka 2.X 停止开发,但注册中心还有更多选择:Consul 使用详解

    在上个月我们知道 Eureka 2.X 遇到困难停止开发了,但其实对国内的用户影响甚小,一方面国内大都使用的是 Eureka 1.X 系列,另一方面 Spring Cloud 支持很多服务发现的软件, ...

  5. matplot绘图基本使用

    先看一个最简单的例子 import matplotlib.pyplot as plt plt.figure() plt.subplot(211) plt.plot([1,2,3], color=''r ...

  6. c++入门之文件读取

    再次强调这个观念:写文件,读文件和读,写控制台本质上没有区别,意识到这一点是十分重要的.下面给出读文件的代码: #include "iostream" # include &quo ...

  7. ES优化

    1.内存优化 在bin/elasticsearch.in.sh中进行配置 修改配置项为尽量大的内存: 1 2 ES_MIN_MEM=8g ES_MAX_MEM=8g 两者最好改成一样的,否则容易引发长 ...

  8. Python_面向对象基础

    概念 类 一类抽象的事物,是描述了一类事物有哪些属性或者行为,但不是具体——模子. 实例 一个依托于类的规范存在的,被赋予了具体属性值的实际存在的物体. 对象 就是实例,实例的另外一个名称,相当于别名 ...

  9. PHP中友好的处理方式

    在使用PHP进行开发的时候,由于PHP是弱类型语言的特性,所以,偶尔会遇到一些意想不到的错误.规范我们的编程就变得尤为重要了.下面总结一下,我日常开发中的一些经验,可能有些地方不妥,还请多多斧正,指教 ...

  10. 开发工具之Sublime编辑器

    sublime是一款轻量级的编辑器,可以从官网上进行下载最新版本.它有很多使用并且强大的功能支持.例如:GOTO,package 等快捷操作.但有时候下载的版本不能进行安装package contro ...