車輛乘載人數分析指南

主控台中的車輛乘載人數分析模型資訊卡

占用率分析模型可根據您在影片影格中新增的特定輸入內容,計算人數或車輛數量。與人車偵測器模型相比,占用率分析模型提供進階功能。這些功能包括活動區計數、線條越界計數和居住偵測。

  • 警戒區可讓使用者計算特定使用者定義區域內的人或車輛。
  • 線條交叉可讓您計算物件穿越特定線條的方向。
  • 停留時間偵測功能會建構在活動區上,並提供偵測功能,可偵測物體是否在區域內停留最少時間。

這個模型會接受影片串流做為輸入內容,並輸出通訊協定緩衝區,其中包含每個影格中偵測到的人員和車輛數量。模型的執行速度為 6 FPS。

用途:智慧城市交通分析

以下影片說明如何使用 Vertex AI Vision 建立、建構及部署人流分析應用程式。

此應用程式使用模型,計算使用者在Google Cloud 控制台中指定的路口中,穿越車道線的車輛數量。此外,應用程式會使用人物模糊處理模型,保護影片動態饋給來源中出現的任何人。

應用程式會將分析結果傳送至 Vertex AI 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%。確保指定的人物和車輛不會離鏡頭太遠。這些主要物件的可視大小必須足夠大。
  • 感興趣的領域必須有適當的光線。
  • 確認影片來源相機鏡頭乾淨清潔。
  • 確認實體 (不包括人或車輛) 不會遮住攝影機的任何視野範圍。
  • 以下因素可能會降低模型效能。取得資料時,請考量下列因素:
    • 光線條件不佳。
    • 人群擁擠和物體遮蔽。
    • 不常見或較不常見的觀點。
    • 小物件尺寸。