A sophisticated, customer-ready AI Face Emotion Detector web application built with ReactJS and Vite, designed to deliver a private, real-time emotion detection experience directly in the browser using a webcam and the face-api.js library.
- Real-time Emotion Detection: Live webcam feed with instant emotion analysis
- 7 Emotion Categories: Happy, Sad, Angry, Surprised, Disgusted, Fearful, and Neutral
- Confidence Scoring: Detailed confidence percentages for each detected emotion
- Face Detection: Visual face detection with bounding boxes
- Emotion History: Chronological log of emotion changes with timestamps
- 100% Client-Side Processing: All analysis happens locally on your device
- No Data Transmission: No video frames or personal data sent to external servers
- Complete Privacy: Your emotions stay private and secure
- Minimalist Design: Elegant black-and-white aesthetic with subtle grid background
- Responsive Layout: Seamless performance across desktops, tablets, and mobile devices
- Accessibility: High-contrast visuals, keyboard navigation, and ARIA-compliant elements
- Smooth Animations: Subtle transitions and fade-ins for emotion updates
- Powered by face-api.js: Advanced facial recognition and emotion analysis
- TensorFlow.js Integration: Robust machine learning capabilities
- Vite Build System: Fast development and optimized production builds
- Modern React: Built with React 18 and modern JavaScript features
- Node.js (version 16 or higher)
- Modern web browser with camera access
- Internet connection (for initial model download)
-
Clone the repository
git clone <repository-url> cd ai-face-emotion-detector
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
npm run buildThe built application will be in the dist directory.
- Allow Camera Access: When prompted, allow the application to access your webcam
- Start Detection: Click the "Start Camera" button to begin emotion analysis
- Position Your Face: Ensure your face is clearly visible in the camera view
- View Results: Watch real-time emotion detection and confidence scores
- Real-time video stream from your webcam
- Visual face detection with green bounding boxes
- Status indicators for face detection
- Current dominant emotion with confidence percentage
- All emotion scores displayed in real-time
- Color-coded emotion indicators
- Chronological log of emotion changes
- Timestamp tracking for each detection
- Statistics on most frequent emotions
- Expandable history view
- Camera can be stopped at any time
- All processing happens locally
- No data is stored or transmitted
- Frontend Framework: React 18
- Build Tool: Vite
- AI Library: face-api.js
- Machine Learning: TensorFlow.js
- Styling: CSS3 with CSS Variables
- Icons: Unicode Emoji Icons
The application can be configured using environment variables:
VITE_APP_TITLE=AI Face Emotion Detector
VITE_APP_DESCRIPTION=Real-time emotion detection with privacyFace detection models are automatically downloaded from the official face-api.js CDN. You can modify the model URLs in src/utils/faceApiLoader.js if needed.
- Initial Load: ~15-30 seconds (model download)
- Detection Speed: Real-time (30+ FPS)
- Memory Usage: ~50-100MB (including models)
- Browser Support: Chrome, Firefox, Safari, Edge (latest versions)
- All video processing occurs locally in your browser
- No video frames are transmitted to external servers
- Emotion analysis uses pre-trained models loaded once
- Camera access is requested only when you start detection
- Camera can be stopped at any time
- No persistent camera access without user consent
- Emotion history is stored only in browser memory
- No data is saved to disk or cloud storage
- History is cleared when the page is refreshed
The application uses CSS custom properties for easy theming. Modify the variables in src/index.css:
:root {
--primary-bg: #000000;
--secondary-bg: #111111;
--accent-color: #ffffff;
/* ... more variables */
}Customize emotion colors in the component files:
src/components/EmotionDisplay.jsxsrc/components/EmotionHistory.jsx
Camera not working
- Ensure camera permissions are granted
- Check if another application is using the camera
- Try refreshing the page
Models not loading
- Check internet connection
- Clear browser cache and reload
- Try a different browser
Slow performance
- Close other browser tabs
- Ensure sufficient system memory
- Use a modern browser with hardware acceleration
- Chrome: Full support (recommended)
- Firefox: Full support
- Safari: Full support (macOS 10.15+)
- Edge: Full support
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- face-api.js: Advanced facial recognition library
- TensorFlow.js: Machine learning framework
- React Team: Frontend framework
- Vite Team: Build tool
For support, questions, or feature requests:
- Create an issue in the repository
- Check the troubleshooting section
- Review the documentation
Powered by Sutralink - Creating value through simplicity and functional excellence.