A real-time eye tracking application with ADHD attention assistant, optimized for Streamlit deployment.
# Windows
deploy.bat local
# Linux/Mac
chmod +x deploy.sh
./deploy.sh local# Windows
deploy.bat docker
# Linux/Mac
./deploy.sh dockerSee the Cloud Deployment section below.
- ✅ Real-time face and eye detection
- ✅ Pupil tracking with optimized algorithms
- ✅ ADHD attention assistant with focus monitoring
- ✅ Interactive Streamlit interface
- ✅ Session statistics and analytics
- ✅ Attention alerts and focus rewards
- ✅ Optimized for deployment on multiple platforms
- Python 3.8 or higher
- Webcam access
- Good lighting conditions
- Modern web browser
All dependencies are listed in requirements_streamlit.txt:
- Streamlit (web interface)
- OpenCV (computer vision)
- NumPy (numerical computations)
- Pillow (image processing)
# Clone the repository
git clone <your-repo-url>
cd Eye-Tracking
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements_streamlit.txt
# Run the application
streamlit run streamlit_app.py# Build the image
docker build -t eye-tracking-app .
# Run the container
docker run -p 8501:8501 eye-tracking-app- Push to GitHub: Upload your code to a GitHub repository
- Visit Streamlit Cloud: Go to share.streamlit.io
- Connect Repository: Link your GitHub account and select the repository
- Configure Deployment:
- Main file:
streamlit_app.py - Requirements file:
requirements_streamlit.txt
- Main file:
- Deploy: Click deploy and wait for the build to complete
# Install Heroku CLI
heroku create your-app-name
heroku container:push web
heroku container:release web- Connect your GitHub repository to Railway
- Select the repository
- Railway will auto-detect the Dockerfile and deploy
# Build and push to Google Container Registry
gcloud builds submit --tag gcr.io/PROJECT-ID/eye-tracking
gcloud run deploy --image gcr.io/PROJECT-ID/eye-tracking --platform managed- Create an App Runner service
- Connect to your GitHub repository
- Use the provided Dockerfile for deployment
- Select Mode: Choose between Eye Detection, ADHD Assistant, or Calibration
- Start Camera: Click "Start Camera" to begin video processing
- Monitor: Watch the live feed and statistics in real-time
- Stop: Click "Stop Camera" when finished
- Basic face and eye detection
- Pupil tracking visualization
- Real-time video processing stats
- Monitors attention and focus
- Provides alerts when attention wanes
- Tracks focus time and session statistics
- Helps maintain concentration during work/study
- Calibrates eye tracking for cursor control
- Maps eye movements to screen coordinates
- Improves tracking accuracy
- Start Camera: Begin video processing
- Stop Camera: End video processing
- Mode Selection: Switch between different tracking modes
- Statistics Panel: View real-time metrics
The application automatically configures optimal camera settings:
- Resolution: 640x480 (for stability)
- FPS: 15 (optimized for deployment)
- Auto-focus and exposure adjustment
- Reduced frame processing for cloud deployment
- Optimized OpenCV operations
- Efficient memory management
- Streamlined detection algorithms
- Solution: Grant camera permissions in your browser
- Chrome: Click the camera icon in the address bar
- Firefox: Click the shield icon and allow camera access
- Lighting: Ensure good, even lighting on your face
- Position: Keep your face centered and at appropriate distance
- Background: Use a plain background for better detection
- Solution: The application is optimized for cloud deployment
- Close other applications to free up resources
- Use Docker deployment for better resource isolation
- Check Python version:
python --version(should be 3.8+) - Verify dependencies:
pip list - Try reinstalling:
pip install -r requirements_streamlit.txt --force-reinstall
- Good Lighting: Ensure your face is well-lit
- Stable Position: Maintain consistent distance from camera
- Plain Background: Use a simple background for better detection
- Browser Performance: Use Chrome or Firefox for best results
- Network: Ensure stable internet for cloud deployments
User Interface (Streamlit)
↓
Camera Input (OpenCV)
↓
Face Detection (Haar Cascades)
↓
Eye Detection & Pupil Tracking
↓
ADHD Assistant Logic
↓
Real-time Display & Statistics
Eye-Tracking/
├── streamlit_app.py # Main Streamlit application
├── requirements_streamlit.txt # Optimized dependencies
├── Dockerfile # Container configuration
├── deploy.sh # Linux/Mac deployment script
├── deploy.bat # Windows deployment script
├── .streamlit/
│ └── config.toml # Streamlit configuration
└── README_DEPLOYMENT.md # This file
- Camera access is only used locally in the browser
- No video data is stored or transmitted
- All processing happens in real-time
- Privacy-focused design
- Check the troubleshooting section above
- Review the application logs in Streamlit
- Ensure your system meets the requirements
- Test camera access in other applications
When reporting issues, please include:
- Operating system and version
- Python version
- Browser type and version
- Error messages or logs
- Steps to reproduce the issue
This project is licensed under the MIT License - see the LICENSE file for details.
- Multi-face tracking
- Advanced calibration options
- Export functionality for session data
- Mobile device support
- Additional attention metrics
- WebGL acceleration
- Optimized models for better detection
- Real-time performance monitoring
- Adaptive quality settings
🎉 Ready to deploy? Choose your preferred method above and get started!