L2Cs-Net
Serverless Hosted API を通じて L2Cs-Net の gaze detection model を使用します
コードサンプル
3
モデルを実行する
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}")推論速度
モデル
レイテンシ (ms)
最終更新
役に立ちましたか?