人员和车辆数量分析指南

控制台中的入住分析模型卡片

借助占用情况分析 模型,您可以根据在视频帧中添加的特定输入来统计人员或车辆的数量。与人员车辆检测器模型相比,占用情况分析模型提供了高级功能。 这些功能包括活跃区域计数、线路穿越计数和停留检测。

  • 借助活跃区域,用户可以统计特定用户定义区域内的人员或车辆数量。
  • 借助线路穿越,用户可以统计对象穿越特定线路的方向。
  • 停留时间检测以活跃区域为基础,能够检测对象是否在某个区域内停留了最短时间。

该模型接受视频流作为输入,并输出一个 协议缓冲区,其中包含每帧中检测到的人员和车辆 数量。该模型以 6 FPS 的速度运行。

使用场景:智慧城市交通分析

以下视频展示了如何使用 Gemini Enterprise Agent Platform Vision 创建、构建和部署占用情况分析应用。

此应用使用模型 来统计用户在 Google Cloud 控制台中指定的十字路口穿越线路的车辆数量。此外,该应用还使用人员模糊模型来保护视频 Feed 来源中出现的任何人的身份。

该应用会将分析后的数据发送到 Gemini Enterprise Agent Platform Vision 的媒体仓库进行媒体存储,还会发送到 BigQuery 以将结构化数据存储在表中。借助该仓库,您可以根据模型中的条件(例如车辆或人员数量)搜索存储的数据。借助 BigQuery 中的表格数据,您可以查询数据以获取分析信息。

模型输出

人员车辆检测会显示在当前处理的帧中检测到的人员和车辆数量。计数类型取决于用户提供的注解输入。原始检测和跟踪结果也会包含在输出中。 以下是协议缓冲区处理器 输出的定义。输出流的频率是恒定的:每秒三帧。

// The prediction result proto for Person/Vehicle Detection.
message OccupancyCountingPredictionResult {

 // Current timestamp.
 google.protobuf.Timestamp current_time = 1;

 // The entity info for annotations from the processor.
 message Entity {
   // Label id.
   int64 label_id = 1;
   // Human readable string of the label.
   string label_string = 2;
 }

 // Identified box contains location and the entity of the object.
 message IdentifiedBox {
   // An unique id for this box.
   int64 box_id = 1;
   // 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;
   }

   // Bounding Box in the normalized coordinates.
   NormalizedBoundingBox normalized_bounding_box = 2;

   // Confidence score associated with this box.
   float score = 3;

   // Entity of this box.
   Entity entity = 4;

   // A unique id to identify a track. It must be consistent across frames.
   // It only exists if tracking is enabled.
   int64 track_id = 5;
 }

 // A list of identified boxes.
 repeated IdentifiedBox identified_boxes = 2;

 // The statistics info for annotations from the processor.
 message Stats {
   // The object info and count for annotations from the processor.
   message ObjectCount {
     // Entity of this object.
     Entity entity = 1;
     // Count of the object.
     int32 count = 2;
   }

   // Counts of the full frame.
   repeated ObjectCount full_frame_count = 1;

   // Message for Crossing line count.
   message CrossingLineCount {
     // Line annotation from the user.
     StreamAnnotation annotation = 1;
     // The direction that follows the right hand rule.
     repeated ObjectCount positive_direction_counts = 2;
     // The direction that is opposite to the right hand rule.
     repeated ObjectCount negative_direction_counts = 3;
   }

   // Crossing line counts.
   repeated CrossingLineCount crossing_line_counts = 2;

   // Message for the active zone count.
   message ActiveZoneCount {
     // Active zone annotation from the user.
     StreamAnnotation annotation = 1;
     // Counts in the zone.
     repeated ObjectCount counts = 2;
   }

   // Active zone counts.
   repeated ActiveZoneCount active_zone_counts = 3;
 }

 // Detection statistics.
 Stats stats = 3;

 // The track info for annotations from the processor.
 message TrackInfo {
   // A unique id to identify a track. It must be consistent across frames.
   string track_id = 1;
   // Start timestamp of this track.
   google.protobuf.Timestamp start_time = 2;
 }

 // The dwell time info for annotations from the processor.
 message DwellTimeInfo {
   // A unique id to identify a track. It must be consistent across frames.
   string track_id = 1;
   // The unique id for the zone in which the object is dwelling/waiting.
   string zone_id = 2;
   // The beginning time when a dwelling object has been identified in a zone.
   google.protobuf.Timestamp dwell_start_time = 3;
   // The end time when a dwelling object has exited in a zone.
   google.protobuf.Timestamp dwell_end_time = 4;
 }

 // Track related information. All the tracks that are live at this timestamp.
 // It only exists if tracking is enabled.
 repeated TrackInfo track_info = 4;

 // Dwell time related information. All the tracks that are live in a given
 // zone with a start and end dwell time timestamp
 repeated DwellTimeInfo dwell_time_info = 5;
}

最佳做法和限制

  • 避免使用不寻常的摄像头视角(例如鸟瞰视图),因为在这种视角下,人员和车辆的呈现方式与标准或常见视角不同。检测质量可能会受到不寻常视角的影响。
  • 确保人员和车辆完全或大部分可见。检测质量可能会受到其他对象部分遮挡的影响。
  • 人员车辆检测器具有可检测到的最小对象大小。此大小约为摄像头画面大小的 2%。确保目标人员和车辆与摄像头之间的距离不要太远。这些关键对象的可视大小必须足够大。
  • 感兴趣的区域必须有适当的光照。
  • 确保视频源摄像头的镜头干净。
  • 确保实体(人员或车辆除外)不会遮挡摄像头视野范围的任何部分。
  • 以下因素可能会降低模型的性能。在获取数据时,请考虑以下因素:
    • 光照条件较差。
    • 拥挤和对象遮挡。
    • 不常见或较少见的视角。
    • 对象尺寸较小。