Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฏ NeuGaze: Facial Expression & Gaze-Based Computer Control

ไธญๆ–‡ๆ–‡ๆกฃ | English

arXiv Demo Video Python Platform License

A non-invasive computer control system that combines facial expression recognition, head movement tracking, and gaze estimation, designed for hands-free human-computer interaction.

This system enables complex action game control, as demonstrated in the video showing Black Myth: Wukong defeating the Yin Tiger boss. It can also be used to play MOBA games like Honor of Kings, FPS games like CS2, and many other game types.

NeuGaze wukong

neugaze_wukong.mp4
---

We are hosting a global CS2 Arms Race Challenge: 2000 RMB for the champion. The first participant to complete the setup, achieve kills in Arms Race against bots, and publish a tutorial video will receive an additional 500 RMB bonus.

๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

Traditional assistive technologies face significant limitations: invasive brain-computer interfaces like Neuralink require surgical implantation, commercial eye trackers like Tobii lack precision for complex operations, and traditional assistive devices often involve cumbersome controls. NeuGaze addresses these challenges by integrating facial expressions, head movements, and gaze estimation to create an intuitive, hands-free control system.

๐Ÿ–ฅ๏ธ Requirements

Component Requirement Description
๐Ÿ“ท Camera Standard webcam No special hardware needed
๐Ÿ’ป Processor CPU-only operation No GPU required
๐ŸชŸ OS Windows Other platforms may work but untested

โญ Key Features

Feature Description Icon
Gaze-based mouse control Real-time calibration, precise tracking ๐ŸŽฏ
Facial expression mapping Keyboard/mouse action mapping ๐Ÿ˜Š
Three-modal control Combining gaze, expressions, and head movements ๐ŸŽฎ
Customizable configurations Adaptable for different use cases โš™๏ธ
Real-time performance CPU-optimized inference ๐Ÿš€

๐Ÿ“Š Performance Evaluation

We conducted comprehensive testing using progressive training on multiple calibration datasets. The system achieves stable gaze tracking performance with the following metrics:

๐Ÿ“ˆ Performance Metrics

  • Mean Error: 48mm (original)
  • After Kalman Filtering: 40mm (optimized)
  • Display Resolution: 3072ร—1920
  • Training Data: Multiple calibration datasets

๐Ÿ’ก Note: Current performance is indeed inferior to Tobii's results, but we welcome community collaboration for improvements!

Progressive Training Analysis

Progressive training results showing error reduction and performance stability across multiple datasets. The analysis demonstrates consistent improvement in gaze accuracy as more training data is incorporated.


๐Ÿš€ Installation

๐ŸŽฏ Recommended Installation

Windows Users

# Double-click to run the installation script
install.bat
๐Ÿ“‹ Script Function Details

The script will automatically:

  1. โœ… Check Python version and conda environment
  2. โœ… Create a conda environment named neugaze
  3. โœ… Guide you to activate the environment and install dependencies
  4. โœ… Verify successful installation

๐Ÿ”ง Manual Environment Setup

# Create and activate conda environment
conda create -n neugaze python=3.11.11
conda activate neugaze

# Install all dependencies
pip install -r requirements.txt

๐ŸŽฎ Quick Start

๐Ÿ“น Video Tutorial

Watch this video to quickly understand the system usage:

Quick Start

๐Ÿ“‹ Step-by-Step Guide

1๏ธโƒฃ Launch the GUI

python config_gui_cpu.py

2๏ธโƒฃ Camera Setup

  • ๐Ÿ“ท Select your camera (default: camera 0)
  • ๐Ÿ‘ค Position your face in the center of the preview window
  • โœ… Click "Confirm Selection"

Camera Selection

3๏ธโƒฃ Calibration Process

  • ๐ŸŽฏ Click "Start Calibration"
  • ๐Ÿ‘๏ธ Follow the on-screen dots with your gaze
  • ๐Ÿ‘€ Keep your eyes open (photos are only taken when eyes are detected)
  • โณ Wait for calibration to complete

4๏ธโƒฃ Start Control

  • ๐ŸŽฎ Click "Start Evaluation"
  • ๐Ÿ–ฑ๏ธ Your mouse cursor will now follow your gaze
  • ๐Ÿ˜Š Use facial expressions to trigger actions

๐Ÿ˜Š Expression & Control Configuration

NeuGaze uses a sophisticated expression recognition system defined in configs/cpu.yaml. The system supports multiple control modes and customizable mappings.

๐ŸŽญ Expression Detection

The system recognizes facial expressions through MediaPipe landmarks and maps them to specific actions:

Core Expression Mapping

Expression Action Description Triggered Operation
Open Mouth (jawOpen) Drop your jaw naturally ๐ŸŽฏ Mode selector - displays available control wheels
Pucker Lips (mouthPucker) Make a kissing motion with pursed lips ๐Ÿ–ฑ๏ธ Left mouse click
Jaw Left (jawLeft) Shift your jaw to the left side ๐Ÿ–ฑ๏ธ Right mouse click
Jaw Right (jawRight) Shift your jaw to the right side ๐Ÿ–ฑ๏ธ Middle mouse click
Smile Left (mouthSmileLeft) Smile with only the left side of your mouth ๐Ÿงญ Navigation/selection
Smile Right (mouthSmileRight) Smile with only the right side of your mouth ๐Ÿงญ Navigation/selection
Both Sides Smile Full natural smile with both sides โšก Special commands
Head Movements Tilt, turn, and nod your head โŒจ๏ธ WASD keys and scrolling

Expression Threshold Adjustment

python learn\mediapipe_example.py

You can use this program to view the scores for different expressions and adjust the thresholds accordingly.

Expression Configuration Example

left_click:
  conditions:
  - feature: mouthPucker
    operator: '>'
    threshold: 0.97
  - feature: mouthFunnel
    operator: <
    threshold: 0.2
  combine: AND

๐ŸŽฎ Control Modes

The system supports multiple operation modes through the wheel interface:

๐ŸŽฏ 1. Game Mode (game)

Optimized for gaming with WASD movement and common game keys:

Wheel Position Key Mapping Function Description
num1 Z/X/C keys ๐ŸŽฎ Common game actions
num2 Shift ๐Ÿƒ Sprint/crouch
num4 Number keys 1-4 โš”๏ธ Weapon selection
num6 Q/R/F/T keys ๐ŸŽฏ Interaction keys
num8 Space โšก Jump

๐ŸŽฏ 2. CS:GO Mode (game_cs)

Specialized for Counter-Strike with tactical bindings:

Wheel Position Key Mapping Function Description
num2 Space โฌ†๏ธ Jump
num8 Shift ๐Ÿšถ Walk/precision
Mouse lock Disabled ๐ŸŽฏ For precise aiming

๐ŸŽฏ 3. Honor of Kings Mode (game_wz)

Optimized for MOBA gameplay (็Ž‹่€…่ฃ่€€/Arena of Valor):

Wheel Position Key Mapping Function Description
num1-3 Skill activation โš”๏ธ Skills 1-3
num4 M key ๐Ÿ—บ๏ธ Map

โŒจ๏ธ 4. Typing Mode (type)

Full keyboard access for text input:

Wheel Position Key Mapping Function Description
num4 Complete alphabet ๐Ÿ”ค Square layout letters
num6 Numbers and symbols ๐Ÿ”ข Square layout numbers and symbols
num2 Modifier keys โŒจ๏ธ Shift, Ctrl, Alt, etc.
num3 Common shortcuts ๐Ÿ“‹ Ctrl+C, Ctrl+V, etc.

โš™๏ธ Advanced Configuration

๐ŸŽฏ Expression Priorities

The system includes priority rules to prevent conflicting expressions:

priority_rules:
- when: num7
  disable: [num2]
  except: []

๐ŸŽจ Wheel Layouts

Different input modes support different wheel layouts:

Layout Type Description Use Case
Default Circular arrangement ๐ŸŽฎ Gaming modes
Square Grid layout โŒจ๏ธ Letter and symbol input

๐ŸŽฏ Head Movement Integration

Head orientation controls additional functions:

Head Movement Key Mapping Function Description
Pitch (up/down) W/S keys โฌ†๏ธโฌ‡๏ธ Up/down movement
Yaw (left/right) A/D keys โฌ…๏ธโžก๏ธ Left/right movement
Roll (tilt) Scroll wheel ๐Ÿ”„ Scrolling operations

๐ŸŽฏ Use Cases

โ™ฟ Accessibility

  • ๐Ÿฆฝ Mobility Assistance: Hands-free computer operation for users with limited mobility
  • ๐Ÿฅ Rehabilitation: Motor skill training through controlled head and facial movements

๐ŸŽฎ Gaming & Entertainment

  • ๐ŸŽฏ Immersive Gaming: Novel input method for enhanced gaming experiences
  • ๐Ÿ’ Action Games: Complex action game control as demonstrated with Black Myth: Wukong boss battles
  • ๐Ÿ† MOBA Games: Strategic gameplay in Honor of Kings and similar MOBAs
  • ๐ŸŽฏ FPS Games: Precision control for Counter-Strike 2 and other competitive shooters
  • ๐Ÿ’ช Muscle Training: Facial and neck muscle exercise through interactive control

๐Ÿค– Smart Device Integration

  • ๐Ÿฅฝ AR/VR Interfaces: Natural control for head-mounted displays
  • ๐Ÿ‘“ Smart Glasses: Expression-based navigation without hand gestures

โš™๏ธ Technical Details

๐Ÿ—๏ธ Architecture

Component Function Description Technical Implementation
๐ŸŽฏ Intent Recognition Comprehensive analysis of facial expressions, head movements, and gaze patterns MediaPipe + custom algorithms
๐Ÿ”„ Intent Mapping Translation of recognized intents into specific keyboard/mouse actions Configuration-driven mapping system
๐ŸŽญ Multi-Modal Fusion Integration and prioritization of multiple simultaneous intents Priority rule engine
โšก Action Execution Coordinated control system enabling complex gaming operations Real-time control interface
๐Ÿš€ Optimization CPU-optimized inference pipeline for real-time performance CPU-optimized inference

โš ๏ธ Limitations

Limitation Impact Solution
๐ŸŒž Lighting Sensitivity Performance degrades in poor or uneven lighting Adjust environmental lighting
๐ŸŽฏ Calibration Required Individual calibration needed for optimal accuracy Regular recalibration
๐Ÿ“š Expression Training Learning curve for natural expression control Practice and adaptation

๐Ÿค Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.

๐ŸŽฏ Contribution Methods

  • ๐Ÿ› Report Issues: Submit bug reports
  • ๐Ÿ’ก Feature Suggestions: Propose new feature ideas
  • ๐Ÿ”ง Code Contributions: Submit pull requests
  • ๐Ÿ“š Documentation Improvements: Help improve documentation

๐Ÿ“„ License

License: CC BY-NC 4.0

This project is licensed under Creative Commons Attribution-NonCommercial 4.0 International License.

โœ… You are free to:

  • โœ… Share and adapt the code for personal use
  • โœ… Use for research and educational purposes
  • โœ… Create derivative works for non-commercial purposes (e.g., streaming, content creation)

โŒ You may NOT:

  • โŒ Sell the source code or derivatives
  • โŒ Deploy as commercial hardware/software products
  • โŒ Package as paid executable applications
  • โŒ Use for commercial web services

๐Ÿ’ก Note: We provide this software freely to benefit the community while preventing exploitation by commercial entities. License terms may be updated to Apache-2.0 or MIT based on community feedback.


๐Ÿ“š Citation

@article{yang2024neugaze,
  title={NeuGaze: Facial Expression and Gaze-Based Computer Control},
  author={Yang, Yiqian},
  journal={arXiv preprint arXiv:2504.15101},
  year={2024}
}

โš ๏ธ Note: This system is designed for research and accessibility purposes. While functional, it may require individual tuning for optimal performance. We encourage experimentation and welcome feedback to improve the system's robustness and usability.


โญ If this project helps you, please give us a star! โญ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages