A lightweight, real-time facial behavior analysis tool built on PyTorch. It provides face detection, landmark alignment, head pose estimation (gaze), and Action Unit (AU) recognition.
- Real-time: Optimized for webcam stream input with frame-skipping control.
- Multitask: Simultaneous emotion recognition, gaze tracking, and AU detection.
- Configurable GUI: User-friendly setup window to toggle features (AU, Gaze, etc.) and select processing device (CPU/GPU).
- Data Recording: Automatically saves analysis data (Emotions, AUs, Gaze) to CSV files in
logs/. - Cross-Platform: One-click setup for both Windows and Linux.
This project requires Python 3.10+ (Tested on 3.12).
git clone https://github.com/iwaszm/openface_realtime.git
cd openface_realtimeSimply double-click setup.bat.
- This will create a virtual environment, install dependencies (including GPU-enabled PyTorch), download model weights (~250MB), and apply necessary patches.
Run the setup script in your terminal:
bash setup.shDouble-click run_gui.bat to launch the configuration window.
Activate the environment and run the GUI launcher:
source venv/bin/activate
python run_gui.pyIn the startup window, you can:
- Select Device: Choose
Auto,CPU, orGPU (CUDA)for processing. - Adjust Speed: Use the slider to skip frames for smoother performance on slower machines.
- Toggle Visuals: Turn on/off landmarks, gaze lines, or emotion labels.
- Select AUs: Choose which Action Units to display and record.
Press Start Analysis to begin. Press q in the video window to stop and exit.
- "No Face Detected": Ensure your lighting is good.
- "GPU selected but not available":
- Ensure you have NVIDIA drivers installed.
- If
setup.batinstalled the CPU version of PyTorch by mistake, run this manually in your project terminal:venv\Scripts\pip uninstall torch torchvision -y venv\Scripts\pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
Based on the OpenFace 2.0/3.0 research and the PyTorch implementation.