
占有率分析モデルを使用すると、動画フレームに追加した特定の入力に基づいて、人や車両をカウントできます。Occupancy Analytics モデルでは、Person Vehicle Detector モデルと比較して高度な機能が提供されます。これらの機能は、アクティブ ゾーン カウント、ラインクロス カウント、滞在検出です。
- アクティブ ゾーンを使用すると、ユーザーが定義した特定のゾーン内の人や車両をカウントできます。
- ラインクロスを使用すると、オブジェクトが特定のラインを横切る方向をカウントできます。
- 滞留時間検出はアクティブ ゾーンに基づいており、オブジェクトがゾーンに最小限の時間滞留したかどうかを検出できます。
このモデルは、動画ストリームを入力として受け取り、各フレームで検出された人物と車両の数を プロトコル バッファとして出力します。モデルは 6 FPS で実行されます。
ユースケース: スマートシティのトラフィック分析
次の動画では、Gemini Enterprise Agent Platform Vision を使用して、占有率分析アプリケーションを作成、構築、デプロイする方法について説明します。
このアプリケーションは、ユーザーがGoogle Cloud コンソールで指定した交差点のラインを横切る車の数をカウントするモデルを使用します。また、動画フィード ソースに映っている人物の身元を保護するために、人物のぼかしモデルを使用します。
アプリケーションは、分析されたデータを Gemini Enterprise Agent Platform Vision の Media Warehouse に送信してメディアを保存し、BigQuery にも送信して構造化データをテーブルに保存します。ウェアハウスでは、車両や人の数など、モデルの条件に基づいて保存されたデータを検索できます。BigQuery のテーブルデータを使用すると、分析情報を取得するためにデータをクエリできます。
モデル出力
[Person Vehicle Detection] には、現在処理中のフレームで検出された人や車両の数が表示されます。カウントのタイプは、ユーザーが提供したアノテーション入力に基づきます。未加工の検出結果とトラッキング結果も出力に含まれます。以下は、プロセッサ出力のプロトコル バッファ定義です。出力ストリームの頻度は一定で、1 秒あたり 3 フレームです。
// 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% です。対象となる人物や車両がカメラから遠すぎないようにしてください。これらのキー オブジェクトの表示サイズは十分に大きくする必要があります。
- 関心のある領域には適切な照明が必要です。
- 動画ソースのカメラレンズがきれいであることを確認します。
- 人物や自動車以外のエンティティがカメラの画角の一部を遮らないようにします。
- 次の要因により、モデルのパフォーマンスが低下する可能性があります。データを取得する際は、次の要素を考慮してください。
- 照明が暗い。
- 混雑度とオブジェクトのオクルージョン。
- 一般的でない、またはあまり一般的でない視点。
- 小さなオブジェクトのサイズ。