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. 随机产生1-12的整数 , 根据产生整数输出一下该月份的季节信息(Math.random()和if语句的应用)

    package com.summer.cn; /** * @author Summer *随机产生1-12的整数 , 根据产生整数输出一下该月份的季节信息 */ public class Test04 ...

  2. bootstrapvalidator 用法

    1.引入js.css 2.用法 API:http://bootstrapvalidator.votintsev.ru/api/ 参考博客:https://blog.csdn.net/u01393846 ...

  3. 记一次项目上线后Log4j2不输出日志的坑

        公司项目采用了Log4j2来输出日志,在开发环境和测试环境下均可以输出日志,但在生成环境就没有日志输出.开始毫无头绪,后来通过不断的排查,终于解决了这个问题.在此记录下该问题的解决过程,便于后 ...

  4. mskitten

    简介 一个普普通通的Java程序员,在某制造业外企工作. 技术栈 主要是Core Java,准备向Java Web挺进. 非计算机专业学生,在努力提升计算机基本素养(操作系统.算法).有好书好资源欢迎 ...

  5. python数据类型--set(集合)

    博客地址:http://www.cnblogs.com/yudanqu/ 首先,简单介绍一下set,set就是我们中学时所学的集合,当时集合的性质就包括一点,集合里不能有重复的数字.我们现在所用到的集 ...

  6. 2017百度软研(C++)

    问了很多,不过很多也都没有问到,感觉有点偏,很深入的东西,越问越虚.第一次实习面试从百度开始,也从百度结束吧.看得见的差距,不想将就,所以还是拿最后一次机会去尝试.win or go home, 所以 ...

  7. Leetcode 153. Find Minimum in Rotated Sorted Array -- 二分查找的变种

    Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e. ...

  8. atcoderI - Coins ( 概率DP)

    I - Coins Time Limit: 2 sec / Memory Limit: 1024 MB Score : 100100 points Problem Statement Let NN b ...

  9. 一个6亿的表a,一个3亿的表b,通过外间tid关联,你如何最快的查询出满足条件的第50000到第50200中的这200条数据记录

    1.如果A表TID是自增长,并且是连续的,B表的ID为索引 select * from a,b where a.tid = b.id and a.tid>500000 limit 200; 2. ...

  10. asp.net mvc5 action多个参数

    需要完成http://site.com/user/add/1/2这样的url解析 使用action的参数直接获取数据的方式 Action声明如下 ) { ViewBag.clubID = id; ) ...