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