[CVPR 2025] Enhancing 3D Gaze Estimation in the Wild using Weak Supervision with Gaze Following Labels
![]() |
![]() |
|---|
Note: The color of the gaze vector follows a gradient from blue (frontal gaze toward the camera) to green (gaze directed away from the camera). Red indicates a gaze perpendicular to the camera, appearing in the middle of the gradient.
Authors: Pierre Vuillecard, Jean-marc Odobez
This repository contains the code and checkpoints for our CVPR 2025 paper "Enhancing 3D Gaze Estimation in the Wild using Weak Supervision with Gaze Following Labels".
First, we need to clone the repository
git clone
cd <name_of_the_repo>Next, create the conda environment and activate it after installing the necessary packages:
conda env create -f environment.yaml
conda activate gazeCVPRWriting the output videos requires ffmpeg (with libx264) on your PATH. It is not installed in the conda environment, install it separately (e.g. sudo apt install ffmpeg, or module load ffmpeg on a cluster) and check it with ffmpeg -version.
Download the head detection & tracking models from Hugging Face (optional, demo.py downloads them automatically on first run):
bash setup.shThe demo code is located in the demo.py file. Our Gaze Transformer model can perform inference on both images and videos. The demo first detects all the heads in the input using a head detector. Then, for each detected head, it predicts the gaze direction using our Gaze Transformer model. The output is drawn on the image or video and saved to the specified output directory.
To run the demo on images, only image inference is availabale:
python demo.py --input-filename data/pexels-jopwell-2422290.jpg --output-dir output/ --modality imageTo run the demo on videos, you can either run the model with image inference where each frame is processed independently:
python demo.py --input-filename data/7149282-hd_1280_720_25fps.mp4 --output-dir output/ --modality imageOr you can run the model with video inference where the model uses temporal information to process the video.
python demo.py --input-filename data/7149282-hd_1280_720_25fps.mp4 --output-dir output/ --modality videoAdditional parameters can be set such as the model checkpoint
--checkpoint ./checkpoints/gat_stwsge_gaze360_gf.ckpt # best SOTA model trained on Gaze360 and Gazefollow
--checkpoint ./checkpoints/gat_gaze360.ckpt # best model trained on Gaze360 onlyYou can also run the demo on GPU by adding the --device cuda. To reduce the inference time on video a batch processing is performed. Therefore, the --batch-size and --num-workers parameters can be set to speed up inference.
Heads are detected and tracked with the OmniHead head tracker (YOLO11m + BoT-SORT). On videos, tracks are then interpolated over missing frames and smoothed. The following parameters control it:
--det-conf 0.3 # head detection confidence threshold
--det-iou 0.5 # NMS IoU threshold
--smooth-window 5 # bbox smoothing window (frames)
--no-interpolate # disable interpolation of missing frames in tracks
--no-smooth # disable bbox smoothing
--min-head-size 0 # drop tracks whose mean head width (px) is below this valueFor an input <name>.<ext> and a --modality of image or video, the demo writes to --output-dir:
| File | Content |
|---|---|
<name>_detected_head.csv |
Head detections and tracks |
<name>_<modality>_predicted_gaze.csv |
Same rows as above, plus the predicted gaze |
<name>_<modality>_output.mp4 / .png |
Input video or image with heads and gaze drawn |
Each row of the CSV files is one head in one frame:
| Column | Description |
|---|---|
xmin, ymin, xmax, ymax |
Head bounding box in pixels of the original frame |
pid |
Person (track) id, constant over a video. For images, heads are numbered 1..N |
frame_id |
Frame index, starting at 1 (always 1 for images) |
conf |
Head detection confidence. 0 means the box was interpolated over a frame where the head was not detected |
gaze_x, gaze_y, gaze_z |
Unit 3D gaze direction in the head's coordinate frame, see below (predicted_gaze file only) |
The gaze vector follows the Gaze360 convention. It is expressed in a frame attached to each head: z points along the line from the camera to the head (away from the camera), y points up and x points to the left of the image. So (0, 0, -1) always means looking straight at the camera, wherever the person is in the image. Because this frame depends on the head position, the same gaze values correspond to different directions in camera coordinates for heads at different places in the image.
The predicted gaze
With the head box center
The dataset preprocessing for training will be released in the future.
- Gaze360 License: Research use only
- Gazefollow License: NonCommercial
- Our model is buit upon Swin3D from omnivore and used as pretrained model. code License: Attribution-NonCommercial 4.0 International
- Head detection & tracking from OmniHead (code License: AGPL-3.0): YOLO11m head detector weights (License: CC BY-NC-SA 4.0) with the BoT-SORT tracker code (License: MIT) through ultralytics (License: AGPL-3.0)
If you use this work, please cite the following paper:
@INPROCEEDINGS{vuillecard3DGAZEWILD2025,
author = {Vuillecard, Pierre and Odobez, Jean-Marc},
projects = {Idiap},
month = jun,
title = {Enhancing 3D Gaze Estimation in the Wild using Weak Supervision with Gaze Following Labels},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2025},
pdf = {https://publications.idiap.ch/attachments/papers/2025/Pierre_3DGAZEESTIMATIONINTHEWILD_2025.pdf}
}

