Skip to content

Anjan50/face

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Face Emotion Detector

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.

🌟 Features

Core Functionality

  • 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

Privacy & Security

  • 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

User Experience

  • 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

Technical Excellence

  • 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

πŸš€ Quick Start

Prerequisites

  • Node.js (version 16 or higher)
  • Modern web browser with camera access
  • Internet connection (for initial model download)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd ai-face-emotion-detector
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:3000

Building for Production

npm run build

The built application will be in the dist directory.

πŸ“± Usage

Getting Started

  1. Allow Camera Access: When prompted, allow the application to access your webcam
  2. Start Detection: Click the "Start Camera" button to begin emotion analysis
  3. Position Your Face: Ensure your face is clearly visible in the camera view
  4. View Results: Watch real-time emotion detection and confidence scores

Features Guide

Live Camera Feed

  • Real-time video stream from your webcam
  • Visual face detection with green bounding boxes
  • Status indicators for face detection

Emotion Analysis

  • Current dominant emotion with confidence percentage
  • All emotion scores displayed in real-time
  • Color-coded emotion indicators

Emotion History

  • Chronological log of emotion changes
  • Timestamp tracking for each detection
  • Statistics on most frequent emotions
  • Expandable history view

Privacy Controls

  • Camera can be stopped at any time
  • All processing happens locally
  • No data is stored or transmitted

πŸ› οΈ Technology Stack

  • 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

πŸ”§ Configuration

Environment Variables

The application can be configured using environment variables:

VITE_APP_TITLE=AI Face Emotion Detector
VITE_APP_DESCRIPTION=Real-time emotion detection with privacy

Model Configuration

Face 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.

πŸ“Š Performance

  • 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)

πŸ”’ Privacy & Security

Data Processing

  • 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

  • Camera access is requested only when you start detection
  • Camera can be stopped at any time
  • No persistent camera access without user consent

Data Storage

  • 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

🎨 Customization

Styling

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 */
}

Emotion Colors

Customize emotion colors in the component files:

  • src/components/EmotionDisplay.jsx
  • src/components/EmotionHistory.jsx

πŸ› Troubleshooting

Common Issues

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

Browser Compatibility

  • Chrome: Full support (recommended)
  • Firefox: Full support
  • Safari: Full support (macOS 10.15+)
  • Edge: Full support

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • face-api.js: Advanced facial recognition library
  • TensorFlow.js: Machine learning framework
  • React Team: Frontend framework
  • Vite Team: Build tool

πŸ“ž Support

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.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published