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. [MicroPython]TPYBoard智能小车“飞奔的TPYBoard装甲一号”

    智能小车作为现代的新发明,是以后的发展方向,他可以按照预先设定的模式在一个环境里自动的运作,不需要人为的管理,可应用于科学勘探等等的用途.智能小车能够实时显示时间.速度.里程,具有自动寻迹.寻光.避障 ...

  2. Docker存储卷(V18.X)

    简介 介绍 Docker的存储卷称之为volume,本质上容器上的一个或者多个目录,而这些目录绕过了联合文件系统,与宿主机中的目录或者其他容器目录进行了绑定关系,这种绑定关系可以看作Linux的mou ...

  3. 搭建SpringBoot+dubbo+zookeeper+maven框架(三)

    今天我们要在原来搭建的框架基础上集成redis数据库. redis是Nosql数据库中使用较为广泛的非关系型内存数据库,redis内部是一个key-value存储系统.它支持存储的value类型相对更 ...

  4. 分享一个公众号h5裂变吸粉源码工具

    这次我是分享我本人制作的一个恶搞程序,说白了就是一个公众号裂变吸粉工具,市面上有很多引流方法,例如最常见的就是色流,哈哈,今天我跟大家分享的方法是有趣的,好玩的,恶搞的.这个程序上线一天已经收获了61 ...

  5. DOM操作 JS事件 节点增删改查

    --------------------------习惯是社会的巨大的飞轮和最可贵的维护者.——威·詹姆斯 day 49 [value属性操作] <!DOCTYPE html><ht ...

  6. PM2用法简介

    简介 PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控.自动重启.负载均衡等,而且使用非常简单.引用 全局安装 sudo npm install pm2@lat ...

  7. H5 28-优先级之权重问题

    28-优先级之权重问题 我是段落 <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

  8. 漫谈数组去重复方法(亮点是ES6的新API)

    方法1: 利用遍历的思想来进行. <!DOCTYPE html><html lang="en"><head> <meta charset= ...

  9. Django之admin中管理models中的表格

    Django之admin中管理models中的表格 django中使用admin管理models中的表格时,如何将表格注册到admin中呢? 具体操作就是在项目文件夹中的app文件夹中的admin中注 ...

  10. vue图片被加了盗链

    https://www.cnblogs.com/dongcanliang/archive/2017/04/01/6655061.html <meta name="referrer&qu ...