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. 猜数字游戏,判断输入的数字与系统产生的数字是否一致(Math.random()与if嵌套循环)

    package com.summer.cn; import java.util.Scanner; public class Test041509 { /** * java 随机数 Math * Mat ...

  2. Asp.net中web.config配置文件详解(二)

    摘自http://blog.csdn.net/hbqhdlc/article/details/8155668 近日正在看Asp.net,看到Web.config有很不清楚之处,特意从网络.MSDN搜集 ...

  3. python五子棋

    以后不更新了,把以前的一些东西发出来. 这是一个命令行环境的五子棋程序.使用了minimax算法. 除了百度各个棋型的打分方式,所有代码皆为本人所撸.本程序结构与之前的井字棋.黑白棋一模一样. 有一点 ...

  4. 【原创】分布式之redis的三大衍生数据结构

    引言 说起redis的数据结构,大家可能对五大基础数据类型比较熟悉:String,Hash,List,Set,Sorted Set.那么除此之外,还有三大衍生数据结构,大家平时是很少接触的,即:bit ...

  5. 单点登录SSO:可一键运行的完整代码

    单点登录方案不同于一个普通站点,它的部署比较繁琐:涉及到好几个站点,要改host.安装证书.配置HTTPS. 看到的不少这方面示例都是基于HTTP的,不认同这种简化: 1. 它体现不出混合HTTP/H ...

  6. Linux iostat 命令

    iostat 命令是 I/O statistics(输入/输出统计)的缩写,用来报告系统的 CPU 统计信息和块设备及其分区的 IO 统计信息.iostat 是 sysstat 工具集的一个工具,在 ...

  7. Python-random模块-59

    random模块: 随机数模块 >>> import random #随机小数 >>> random.random() # 大于0且小于1之间的小数 0.76643 ...

  8. 小L的项链切割 (回文串)

    题目描述 小T送给了小L了一串项链.为了方便,我们把项链上形态不同钻石用不同的字母表示.这样小L的项链就变成了一个字符串.小L忽然想把这串项链优美地切割一下,她想把它切割成尽量少的回文项链,啊也就是回 ...

  9. 周末时间学习Linux

    大家都是如何度过周末时光的呢?好多人都认为一周的工作后要好好休息下,于是在家疯狂的补觉,刷剧,打游戏,自我觉得很是正常,工作几天了,休息下不是当然嘛.是的,休息下很正常,但是把周末的时光都用到这些东西 ...

  10. Makes And The Product CodeForces - 817B (思维+构造)

    B. Makes And The Product time limit per test 2 seconds memory limit per test 256 megabytes input sta ...