> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-ko/deploy/supported-models/l2cs-net.md).

# L2Cs-Net

L2Cs-Net은 얼굴을 감지하고 각 얼굴의 yaw 및 pitch 각도를 예측하는 시선 방향 추정 모델입니다. 이를 통해 실행할 수 있습니다. [Serverless Hosted API](/roboflow/roboflow-ko/deploy/serverless-hosted-api-v2.md).

## 코드 샘플

HTTP 엔드포인트를 통해 L2Cs-Net을 직접 실행하려면 `curl`또는 [`inference-sdk`](https://inference.roboflow.com/inference_helpers/inference_sdk/) 래퍼를 사용하세요.

{% tabs %}
{% tab title="HTTP (curl)" icon="webhook" %}
{% stepper %}
{% step %}

### API Key를 받으세요

Roboflow 계정을 만들고, 다음에서 키를 찾으세요: [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 그리고 이를 셸에서 사용할 수 있도록 설정하세요:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### 모델을 실행하세요

다음에 호출하세요. `/gaze/gaze_detection` 엔드포인트를 `curl`:

```bash
curl --location 'https://serverless.roboflow.com/gaze/gaze_detection' \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "'"$ROBOFLOW_API_KEY"'",
    "image": {"type": "url", "value": "https://media.roboflow.com/inference/man.jpg"}
  }'
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
{% stepper %}
{% step %}

### API Key를 받으세요

Roboflow 계정을 만들고, 다음에서 키를 찾으세요: [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 그리고 이를 셸에서 사용할 수 있도록 설정하세요:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### 종속성을 설치하세요

이 패키지는 다음 모델을 호출합니다:

```bash
pip install inference-sdk
```

{% endstep %}

{% step %}

### 모델을 실행하세요

아래 코드 샘플은 다음을 호출합니다. `detect_gazes`로, 동일한 `/gaze/gaze_detection` 엔드포인트를 호출합니다:

```python
import os
import cv2
import numpy as np
import requests
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/inference/man.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
).select_api_v1()

result = client.detect_gazes(image)

for prediction in result[0]["predictions"]:
    face = prediction["face"]
    yaw = prediction["yaw"]
    pitch = prediction["pitch"]
    print(f"Face at ({face['x']}, {face['y']}) - yaw: {yaw:.3f}, pitch: {pitch:.3f}")
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## 추론 속도

다음 기준으로 측정한 지연 시간 [Roboflow Inference](https://inference.roboflow.com/) 1x NVIDIA L4에서, 배치 크기 1로, 워밍업 이후 평균값입니다.

<table data-search="false"><thead><tr><th>모델</th><th>지연 시간(ms)</th></tr></thead><tbody><tr><td><code>l2cs-net</code></td><td>6.0</td></tr></tbody></table>

모델이 입력으로 기대하는 단일 얼굴 크롭에서 측정되었습니다.

{% hint style="info" %}
설정 `api_url` 을 배포 대상에 맞게 설정하세요:

* `https://serverless.roboflow.com` Serverless Hosted API용입니다.
* `http://localhost:9001` 로컬 [Inference](https://inference.roboflow.com/) 서버용입니다.
* 귀하의 [Dedicated Deployment](/roboflow/roboflow-ko/deploy/dedicated-deployments.md) 비공개 엔드포인트용 URL입니다.
  {% endhint %}

응답에는 다음이 포함된 목록이 들어 있습니다. `predictions` (각각 다음을 포함: `face` bounding box, `landmarks`, `yaw`그리고 `pitch` (라디안 단위), `시간`, `time_face_det`그리고 `time_gaze_det`.

자가 호스팅 배포 및 추가 예시는 다음을 참조하세요. [Roboflow Inference 문서](https://inference.roboflow.com/).
