# Gaze Detection を使用

動画内のフレームに gaze detection を適用できます。Roboflow Video Inference API は、誰かがどの方向を見ているか、また誰がどの地点を見ているかを計算するために必要なデータを返します。

[gaze detection の結果の後処理について詳しく学ぶ](https://blog.roboflow.com/gaze-direction-position/).

### Video Inference API で Gaze Detection を使用する

まず、Roboflow の Python パッケージをインストールします。

```bash
pip install roboflow
```

次に、新しい Python ファイルを作成し、以下のコードを追加します。

```python
from roboflow import Roboflow, GazeModel

rf = Roboflow(api_key="API_KEY")
model = GazeModel()

job_id, signed_url, expire_time = model.predict_video(
    "football-video.mp4",
    fps=5,
    prediction_type="batch-video",
)

results = model.poll_until_video_results(job_id)

print(results)
```

上記の箇所を次のように置き換えてください:

* `API_KEY`: Roboflow の API キーに置き換えます
* `PROJECT_NAME`: Roboflow の project ID に置き換えます。
* `MODEL_ID`: Roboflow の model ID に置き換えます。

[API キーの取得方法を確認する](https://docs.roboflow.com/api-reference/authentication#retrieve-an-api-key).

[model ID の取得方法を確認する](https://docs.roboflow.com/api-reference/workspace-and-project-ids).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/serverless/video-inference/use-gaze-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
