Ahmednull/L2CS-Net
Ahmednull/L2CS-Net has 540 GitHub stars and 115 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-22 22:41 UTC. Last push 2024-02-02.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
The official PyTorch implementation of L2CS-Net for gaze estimation and tracking
머신러닝README.md
Original
L2CS-Net
The official PyTorch implementation of L2CS-Net for gaze estimation and tracking.
Installation
Install package with the following:
pip install git+https://github.com/edavalosanaya/L2CS-Net.git@main
Or, you can git clone the repo and install with the following:
pip install [-e] .
Now you should be able to import the package with the following command:
$ python
>>> import l2cs
Usage
Detect face and predict gaze from webcam
from l2cs import Pipeline, render
import cv2
gaze_pipeline = Pipeline(
weights=CWD / 'models' / 'L2CSNet_gaze360.pkl',
arch='ResNet50',
device=torch.device('cpu') # or 'gpu'
)
cap = cv2.VideoCapture(cam)
_, frame = cap.read()
# Process frame and visualize
results = gaze_pipeline.step(frame)
frame = render(frame, results)
Demo
- Download the pre-trained models from here and Store it to models/.
- Run:
python demo.py \
--snapshot models/L2CSNet_gaze360.pkl \
--gpu 0 \
--cam 0 \
This means the demo will run using L2CSNet_gaze360.pkl pretrained model
Community Contributions
- Gaze Detection and Eye Tracking: A How-To Guide: Use L2CS-Net through a HTTP interface with the open source Roboflow Inference project.
MPIIGaze
We provide the code for train and test MPIIGaze dataset with leave-one-person-out evaluation.
Prepare datasets
- Download MPIIFaceGaze dataset from here.
- Apply data preprocessing from here.
- Store the dataset to datasets/MPIIFaceGaze.
Train
python train.py \
--dataset mpiigaze \
--snapshot output/snapshots \
--gpu 0 \
--num_epochs 50 \
--batch_size 16 \
--lr 0.00001 \
--alpha 1 \
This means the code will perform leave-one-person-out training automatically and store the models to output/snapshots.
Test
python test.py \
--dataset mpiigaze \
--snapshot output/snapshots/snapshot_folder \
--evalpath evaluation/L2CS-mpiigaze \
--gpu 0 \
This means the code will perform leave-one-person-out testing automatically and store the results to evaluation/L2CS-mpiigaze.
To get the average leave-one-person-out accuracy use:
python leave_one_out_eval.py \
--evalpath evaluation/L2CS-mpiigaze \
--respath evaluation/L2CS-mpiigaze \
This means the code will take the evaluation path and outputs the leave-one-out gaze accuracy to the evaluation/L2CS-mpiigaze.
Gaze360
We provide the code for train and test Gaze360 dataset with train-val-test evaluation.
Prepare datasets
Download Gaze360 dataset from here.
Apply data preprocessing from here.
Store the dataset to datasets/Gaze360.
Train
python train.py \
--dataset gaze360 \
--snapshot output/snapshots \
--gpu 0 \
--num_epochs 50 \
--batch_size 16 \
--lr 0.00001 \
--alpha 1 \
This means the code will perform training and store the models to output/snapshots.
Test
python test.py \
--dataset gaze360 \
--snapshot output/snapshots/snapshot_folder \
--evalpath evaluation/L2CS-gaze360 \
--gpu 0 \
This means the code will perform testing on snapshot_folder and store the results to evaluation/L2CS-gaze360.
관련 프로젝트 살펴보기
불러오는 중…