45

通过评估遭遇山火灾害的居住来区识别烧毁和完好的房屋

 5 years ago
source link: http://www.ibm.com/developerworks/cn/cognitive/library/cc-tutorials-detect-wildfire-damaged-homes-using-drone-images-watson-visual-recognition/index.html?ca=drs-&%3Butm_source=tuicool&%3Butm_medium=
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本教程展示如何使用无人机航拍影像、Watson Studio 和 Watson Visual Recognition 来评估遭遇山火灾害的街区,并识别烧毁和完好的房屋。

QVjeyiv.png!web

QVjeyiv.png!web

学习目标

完成本教程后,您将能够:

  • 在 IBM Cloud 中运行的 Watson Studio 中创建 Visual Recognition 模型
  • 捕获无人机拍摄的影像并将其压缩到某个类别中
  • 训练模型识别影像中的对象
  • 对识别的对象进行评分和计数

前提条件

您可使用 IBM Cloud Lite 帐户完成本教程。

  • 创建一个IBM Cloud 帐户。
  • 登录到IBM Cloud。

预估时间

本教程大约需要 15 分钟完成。

第 1 步:了解无人机

从普通玩具到工业用例,无人机可谓多种多样、应有尽有。许多无人机现在都搭载摄像机,可存储航拍视频或将其传送至地面。通过使用直播视频帧,您可以对帧进行采样,并将影像发送到 Watson Visual Recognition 进行分类。

第 2 步:捕获影像

操纵无人机的有趣体验之一就是从独特的航拍视角捕获视频或图片。您可以使用无人机来捕获目标对象的影像,以便用于训练 Visual Recognition 模型进行自主识别。

在本教程中,我为无人机记录下来的图片创建了三个 zip 文件。我将使用这些影像来识别 2018 年遭遇毁灭性的西海岸山火灾害的居住区。这些影像将作为训练集使用。

  • 无人机航拍的被烧毁房屋的影像 - BurnedHomes.zip
  • 无人机航拍的完好房屋的影像 - AerialHomes.zip
  • 无人机航拍的归入 negative 一类的森林、道路与河流影像。 NotHomes.zip

资料来源:《今日美国》 文章 和各种互联网信息来源

第 3 步:设置 Watson Studio

在本部分中,我们会创建一个 Watson Studio 帐户、创建一个项目,并创建一个 Watson Visual Recognition 模型来识别多个类别中的影像。

创建 Cloud Object Storage

  1. 访问 IBM Cloud 目录 ,创建 Cloud Object Storage 实例。
  2. 在 IBM Cloud 目录( Catalog)中搜索 Object
  3. 单击 Object Storage 服务标贴。 FfeuMzU.png!web
    FfeuMzU.png!web
  4. 单击 CreateMVFZr2N.png!web
    MVFZr2N.png!web

创建 Watson Studio 服务实例

  1. IBM Cloud 目录 创建 Watson Studio 服务实例。
  2. 在 IBM Cloud 目录中搜索 StudiorIn6NjV.png!web
    rIn6NjV.png!web
  3. 单击 Watson Studio 服务标贴。 NfYVvqz.png!web
    NfYVvqz.png!web
  4. 单击 Create
  5. 创建 Watson Studio 服务后,单击 Get Started 或者访问Watson Studio。 3uMvy2F.png!web
    3uMvy2F.png!web
  6. 使用您的 IBM Cloud 帐户登录。
  7. 浏览介绍性教程,了解 Watson Studio。 Mzayqqv.png!web
    Mzayqqv.png!web

Watson Studio 项目

项目是用于组织资源的工作区,例如,数据等资产、协作者以及 Notebook 和模型之类的分析工具。

创建一个新项目

  1. 单击 Create a Project
  2. 选择 Standard 标贴并按 Create Project 按钮。 iuI3Eri.png!web
    iuI3Eri.png!web
  3. 将您的项目命名为 Wildfire Burned Homes 。应预先填充先前步骤中创建的 Cloud Object Storage 实例。
  4. 点击 CreateZVnAfmF.png!web
    ZVnAfmF.png!web

您已准备好使用 Watson Visual Recognition 来设置项目。

将 Visual Recognition 添加到 Watson Studio 项目

单击 Settings 选项卡来添加 Visual Recognition。

UZbeQzE.png!web

UZbeQzE.png!web

Associated Services 下面,单击 Add Servicel 并选择 Watson

rEzqmub.png!web

rEzqmub.png!web

配置新的 Watson Visual Recognition 服务实例

  1. 选择 Visual Recognition 标贴。
  2. 选择 Lite 套餐,并注意其中包含的功能部件。
  3. 滚动到底部,并单击 Create
v22am2u.png!web

v22am2u.png!web

创建新的 Watson Visual Recognition 模型

要创建一个Watson Visual Recognition 模型,单击 + Add to project 并选择 Image classification model

FNRFfi2.png!web

FNRFfi2.png!web

重命名 Visual Recognition 模型

Default Custom Model名称不具有描述性,因此让我们来重新命名。

  1. 单击 pencil 图标编辑名称。 YrMZr2i.png!web
    YrMZr2i.png!web
  2. 将模型重命名为 Count Burned HomesqeQrY3r.png!web
    qeQrY3r.png!web

向 Watson Visual Recognition 模型添加自定义分类

  1. 单击 + 号创建分类。 B3M3Qb6.png!web
    B3M3Qb6.png!web
  2. 将该分类命名为 Burned Home
  3. 单击 CreateBryIRfI.png!web
    BryIRfI.png!web
  4. 再次单击 + 号添加第二个自定义分类。 ua22QnE.png!web
    ua22QnE.png!web
  5. 将此分类命名为 Intact Home
  6. 单击 Create2iQZviN.png!web
    2iQZviN.png!web

将 ZIP 文件上传至 Watson Studio 项目

包含无人机航拍影像的三个 ZIP 文件已准备就绪。这些文件为:

  • BurnedHomes.zip
  • AerialHomes.zip
  • NotHomes.zip
  • 单击 Browse 。这样会打开操作系统本机"文件"对话框。
  • 将三个 ZIP 文件 BurnedHomes.zipAerialHomes.zipNotHomes.zip 全部选中。
  • 将这些 ZIP 文件上传至 Watson Studio 项目。 7JVf2az.png!web
    7JVf2az.png!web

将 ZIP 文件拖到自定义类别中

  1. BurnedHomes.zip 文件从右侧导航栏拖到 Burned Home 类别中。 2y2qQfv.png!web
    2y2qQfv.png!web
    JvY7Jjr.png!web
    JvY7Jjr.png!web
    这样会将 ZIP 文件中的影像添加到 Burned Home 类别中。 yui2Azu.png!web
    yui2Azu.png!web
  2. AerialHomes.zip 文件从右侧导航栏拖到 Intact Home 类别中。 JbQfQ3q.png!web
    JbQfQ3q.png!web
  3. NotHomes.zip 文件从右侧导航栏拖到 Negative 类别中。 aqiEZ3j.png!web
    aqiEZ3j.png!web

训练 Watson Visual Recognition 自定义分类器

  1. 单击 Train Model
  2. 等待几分钟,以便模型根据影像进行训练。 auy2UbE.png!web
    auy2UbE.png!web
    INZBv2I.png!web
    INZBv2I.png!web
  3. 训练完模型后,单击 Click here 链接查看和测试自己的模型。 vEZveuE.png!web
    vEZveuE.png!web

第 4 步:测试模型

  1. 复查分类和模型详细信息。
  2. 单击 Test 选项卡。 iqMjeeq.png!web
    iqMjeeq.png!web

使用样本影像来测试 Watson Visual Recognition 自定义分类器

  1. 访问 英国《每日邮报》文章 ,下载一些无人机拍摄的加利福尼亚州街区惨遭烧毁的影像。
  2. 浏览影像或者将其拖到 Test 页面上,将这些影像加载至 Test 页面。 mEfiiiR.png!web
    mEfiiiR.png!web
  3. 检验 Watson Visual Recognition 自定义分类器返回的评分。 zYviYjy.png!web
    zYviYjy.png!web

在应用程序中实现 Watson Visual Recognition 自定义模型

您可使用各种编程语言将此 Watson Visual Recognition 自定义分类器模型整合到自己的应用程序中。

  1. 单击 Implementation 选项卡复查代码片段。 E3QzAfF.png!web
    E3QzAfF.png!web
  2. 使用以下代码片段根据您的模型对影像进行分类。为便于参考,这里提供了完整的API 规范。
    • API 端点
      https://gateway.watsonplatform.net/visual-recognition/api
    • 身份验证
      curl -u "apikey:{apikey}" "https://gateway.watsonplatform.net/visual-recognition/api/{method}"
    • 对影像进行分类 (GET)
      curl -u "apikey:{apikey}" "https://gateway.watsonplatform.net/visual-recognition/api/v3/classify?url=https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/fruitbowl.jpg&version=2018-03-19&classifier_ids=CountBurnedHomes_1382538940"
    • 对影像进行分类 (POST)
      curl -X POST -u "apikey:{apikey}"-F "[email protected]" -F "threshold=0.6" -F "classifier_ids=CountBurnedHomes_1382538940" "https://gateway.watsonplatform.net/visual-recognition/api/v3/classify?version=2018-03-19"

结束语

本教程解释了如何使用无人机航拍影像、Watson Studio 和 Watson Visual Recognition 来评估遭遇山火灾害的居住区,并识别烧毁和无损的房屋。现在,您应已掌握如何在 IBM Cloud 中运行的 Watson Studio 中创建 Visual Recognition 模型,捕获无人机拍摄的影像并将其压缩到某个类别中,训练模型识别影像中的对象,以及对识别的对象进行评分和计数。

参考资源

本文翻译自: Survey wildfire-damaged neighborhoods to identify burned homes and intact homes (2018-12-14)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK