Reachy Mini documentation

ヘッドトラッキング

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

ヘッドトラッキング

この例では、デーモン側のヘッドトラッキングを有効にします。Reachy Miniは最も近い顔を追跡して頭を向け、鼻をターゲットとします。検出はデーモン内で実行されるため(ONNX Runtime上のYuNet)、スクリプトはトラッキングの切り替えと最新の顔ターゲットのポーリングのみを行います。

以下で実行します:

python head_tracking.py

start_head_tracking(weight=...) はブレンド係数を受け取ります。1.0 を指定するとトラッキングがヘッドを制御し、0.0 を指定するとトラッカーを停止せずに検出を一時停止します(ヘッドと CPU を解放)。会話のターン間でアプリケーションにヘッドを返す際に便利です。


from reachy_mini import ReachyMini

with ReachyMini() as mini:
    mini.start_head_tracking()
    try:
        while True:
            # Waits for the next daemon status broadcast, so the loop runs at ~1 Hz.
            face = mini.get_tracked_face()
            if face.detected:
                print(f"Face at x={face.x:+.2f}, y={face.y:+.2f}")
            else:
                print("No face detected")
    except KeyboardInterrupt:
        pass
    finally:
        mini.stop_head_tracking()
Update on GitHub