个人防护用品 (PPE) 检测器指南

控制台中的人物模糊处理模型卡片

个人防护用品 (PPE) 检测器模型可帮助您验证工作场所或社区环境中是否有可限制接触危险的设备。

该模型可检测人员以及特定人员身上的个人防护用品(手套、口罩和头盔)。该模型会检测 PPE 物品,以及这些物品是否覆盖了相应的人体部位。模型会将此覆盖率信息报告为介于 [0, 1] 之间的覆盖率得分。该模型接受视频流作为输入。模型会将检测结果输出为协议缓冲区,您可以在 BigQuery 中查看该缓冲区。模型以 1 FPS 的速度运行。

PPE 检测操作符有三个可供您设置的控制参数:

  • 头部防护用品:操作者输出与头部防护相关的 PPE 项信息。在 Google Cloud 控制台中设置此值,或在 PersonalProtectiveEquipmentDetectionConfig 中将 enableHeadCoverageDetection 设置为 true。
  • 口罩:此运算符会输出与遮盖面部的个人防护装备项相关的信息。在 Google Cloud 控制台中设置此值,或在 PersonalProtectiveEquipmentDetectionConfig 中将 enableFaceCoverageDetection 设置为 true。
  • 手套:操作者输出与手套相关的个人防护用品项信息。在 Google Cloud 控制台中设置此值,或在 PersonalProtectiveEquipmentDetectionConfig 中将 enableHandsCoverageDetection 设置为 true。

PPE 检测器模型应用规范

按照以下说明在Google Cloud 控制台中创建 PPE 检测器模型。

控制台

在 Google Cloud 控制台中创建应用

  1. 如需创建 PPE 检测器应用,请按照构建应用中的说明操作。

    前往“应用”标签页

添加 PPE 检测器模型

  1. 添加模型节点时,请从预训练模型列表中选择 PPE 检测器

  2. 在选项菜单中设置要检测的个人防护用品类型。

添加 BigQuery 连接器

  1. 如需使用输出,请将应用连接到 BigQuery 连接器。

    如需了解如何使用 BigQuery 连接器,请参阅将数据连接并存储到 BigQuery。如需了解 BigQuery 价格信息,请参阅 BigQuery 价格页面。

在 BigQuery 中查看输出结果

模型将数据输出到 BigQuery 后,您可以在 BigQuery 信息中心查看输出注释。

如果您未指定 BigQuery 路径,则可以在 Vertex AI Vision Studio 页面中查看系统创建的路径。

  1. 在 Google Cloud 控制台中,打开 BigQuery 页面。

    转到 BigQuery

  2. 选择目标项目、数据集名称和应用名称旁边的 Expand(展开)。

    在 BigQuery 中选择“应用”表

  3. 在表格详情视图中,点击预览。在注释列中查看结果。如需了解输出格式,请参阅模型输出

应用会按时间顺序存储结果。最早的结果位于表格的开头,而最新的结果则添加到表格的末尾。如需查看最新结果,请点击页码以前往最后一个表格页。

模型输出

模型输出包括时间戳、检测框、与框对应的对象标签以及该对象的置信度分数。输出流的速率为每秒一帧。

模型输出采用 protocol buffer 格式,其中包含视频帧和个人防护用品检测预测结果的相关信息。该模型的目标是检查人们是否正确佩戴了防护设备。因此,该模型会专注于检测人员和人员所穿的个人防护用品。模型输出侧重于人员检测。对于检测到的每个人,该模型都会列出该人周围的个人防护用品以及每件设备的覆盖率得分。

在以下协议缓冲区示例中,请注意以下事项。

  • 当前时间 - 时间戳记录推理结果生成的时间。
  • 检测到的人 - 主要检测结果,其中包含一个识别出的人的边界框、多个识别出个人防护用品的边界框,以及每个身体部位的覆盖率得分。
  • 识别出的人物框 - 边界框、置信度得分和人物实体。
  • PPE 识别出的框 - 边界框、置信度分数和 PPE 实体。

注释输出 JSON 对象示例

{
  "currentTime": "2022-11-10T21:02:13.499255040Z",
  "detectedPersons": [
    {
      "personId": "0",
      "detectedPersonIdentifiedBox": {
        "boxId": "0",
        "normalizedBoundingBox": {
          "xmin": 0.486749,
          "ymin": 0.35927793,
          "width": 0.048630536,
          "height": 0.21746585
        },
        "confidenceScore": 0.31775203,
        "personEntity":{
          "personEntityId":"0"
        }
      },
      "detected_ppe_identified_boxes": {
        "normalized_bounding_box": {
          "xmin": 0.07268746,
          "ymin": 0.80575824,
          "width": 0.22973709,
          "height": 0.18754286
        },
        "confidence_score": 0.45171335,
        "ppe_entity": {
          "ppe_label_string": "Glove",
          "ppe_supercategory_label_string": "Hand Coverage"
        }
      },
      "detected_ppe_identified_boxes":{
        "normalized_bounding_box":{
          "xmin": 0.35457548,
          "ymin": 0.016402662,
          "width": 0.31828704,
          "height": 0.18849815
        },
        "confidence_score": 0.44129524,
        "ppe_entity":{
          "ppe_label_string": "Helmet",
          "ppe_supercategory_label_string": "Head Coverage"
          }
      }
    }
  ]
}

协议缓冲区定义

// Output format for Personal Protective Equipment Detection Operator
message PersonalProtectiveEquipmentDetectionOutput {
 // Current timestamp
 protobuf.Timestamp current_time = 1;

 // The entity info for annotations from person detection prediction result
 message PersonEntity {

   // Entity id
   int64 person_entity_id = 1;
 }

 // The entity info for annotations from PPE detection prediction result
 message PPEEntity {
   // Label id
   int64 ppe_label_id = 1;
   // Human readable string of the label (Examples: helmet, glove, mask)
   string ppe_label_string = 2;
   // Human readable string of the super category label (Examples: head_cover,
   // hands_cover, face_cover)
   string ppe_supercategory_label_string = 3;
   // Entity id
   int64 ppe_entity_id = 4;
 }

 // Bounding Box in the normalized coordinates
 message NormalizedBoundingBox {
   // Min in x coordinate
   float xmin = 1;
   // Min in y coordinate
   float ymin = 2;
   // Width of the bounding box
   float width = 3;
   // Height of the bounding box
   float height = 4;
 }

 // PersonIdentified box contains the location and the entity info of the
 // person
 message PersonIdentifiedBox {
   // An unique id for this box
   int64 box_id = 1;
   // Bounding Box in the normalized coordinates
   NormalizedBoundingBox normalized_bounding_box = 2;
   // Confidence score associated with this box
   float confidence_score = 3;
   // Person entity info
   PersonEntity person_entity = 4;
 }

 // PPEIdentified box contains the location and the entity info of the PPE
 message PPEIdentifiedBox {
   // An unique id for this box
   int64 box_id = 1;
   // Bounding Box in the normalized coordinates
   NormalizedBoundingBox normalized_bounding_box = 2;
   // Confidence score associated with this box
   float confidence_score = 3;
   // PPE entity info
   PPEEntity ppe_entity = 4;
 }

 // Detected Person contains the detected person and their associated
 // PPE and their protecting information
 message DetectedPerson {
   // The id of detected person
   int64 person_id = 1;
   // The info of detected person identified box
   PersonIdentifiedBox detected_person_identified_box = 2;
   // The info of detected person associated ppe identified boxes
   repeated PPEIdentifiedBox detected_ppe_identified_boxes = 3;

   // Coverage score for each body part


   // Coverage score for face
   optional float face_coverage_score = 4;
   // Coverage score for eyes
   optional float eyes_coverage_score = 5;
   // Coverage score for head
   optional float head_coverage_score = 6;
   // Coverage score for hands
   optional float hands_coverage_score = 7;
   // Coverage score for body
   optional float body_coverage_score = 8;
   // Coverage score for feet
   optional float feet_coverage_score = 9;
 }

 // A list of DetectedPersons
 repeated DetectedPerson detected_persons = 2;
}

最佳做法和限制

为了在使用 PPE 检测器时获得最佳结果,请在获取数据和使用模型时考虑以下事项。

源数据建议

建议:请尽可能让检测对象站立不动并面向摄像头。

PPE 检测器能够正确处理的示例图片数据:

示例图片:一个人面对摄像头,脸部被遮挡
图片来源:Unsplash 用户 Ani Kolleshi
示例图片:一个人面对摄像头,脸部被遮挡
图片来源:Unsplash 上的 Ahsanization
示例图片:一个人面对摄像头,脸部被遮挡
图片来源:Unsplash 上的 Anastasiia Chepinska

不推荐:避免提交关键个人防护用品在取景框中过小的图片数据。

以下是 PPE 检测器无法正确处理的示例图片数据:

小到无法检测到的个人防护用品示例图片
图片来源:Unsplash 用户 Josue Isai Ramos Figueroa

不建议:避免使用从不常见的视角或不规则角度显示关键个人防护用品 (PPE) 的图片数据。

以下是 PPE 检测器无法正确处理的示例图片数据:

个人防护用品商品的示例图片,显示角度过于不常见,无法检测到
图片来源:Unsplash 用户 Niclas Moser

限制

  • 分辨率:建议的输入视频分辨率上限为 1920 x 1080,建议的下限为 160 x 120。
  • 可检测到的最小对象大小:模型会忽略场景中占据帧大小不到 5% 的任何对象。
  • 光线:视频光线应正常。视频数据中亮度或黑暗度过高或过低可能会导致检测器性能下降。
  • 个人防护用品佩戴位置:个人防护用品模型侧重于分析人们是否正确佩戴个人防护用品。因此,如果有人未佩戴个人防护用品,模型会忽略该物品。
  • 个人防护用品类型:该模型侧重于建筑防护用品,而非医疗个人防护用品。因此,在医疗中心或医院内,该检测器可能无法正常运行。
  • 自定义 PPE 类型:PPE 模型不支持客户定义的 PPE 项。该模型支持检测头盔、口罩和手套。

此列表并非详尽无遗,这些限制和功能可能会在未来的产品修改中发生变化。