車輛乘載人數分析指南

主控台中的入住率分析模型資訊卡

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

  • 使用者可透過活動區,計算特定使用者定義區域內的人或車輛。
  • 線條穿越功能可計算物體穿越特定線條的方向。
  • 停留時間偵測功能以活動區域為基礎,可偵測物體是否在區域內停留一段時間。

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

用途:智慧城市交通流量分析

以下影片說明如何使用 Gemini Enterprise Agent Platform Vision,建立、建構及部署入住率分析應用程式。

這個應用程式會使用模型計算車輛數量,這些車輛會通過使用者在Google Cloud 控制台中指定的十字路口。此外,應用程式會使用人物模糊模型,保護影片來源中出現的任何人的身分。

應用程式會將分析資料傳送至 Gemini Enterprise Agent Platform Vision 的 media warehouse,以儲存媒體,也會傳送至 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%。確認目標人物和車輛與攝影機的距離不會太遠。這些主要物件的可視大小必須夠大。
  • 感興趣的區域必須有適當的光線。
  • 確認視訊來源攝影機鏡頭乾淨清潔。
  • 確保實體 (人或車輛除外) 不會遮蔽攝影機視野的任何部分。
  • 下列因素可能會降低模型效能。取得資料時,請考量下列因素:
    • 光線不佳。
    • 擁擠程度和物件遮蔽。
    • 不常見或較少見的觀點。
    • 物件大小較小。