Skip to content

chanmazi/face-recognition

Repository files navigation

Face Recognition App

🎉 Project Ready!

A modern React + TypeScript + Vite application integrated with face-api.js for real-time face recognition.

🚀 Quick Start

1. Install Dependencies

pnpm install

2. Start Development Server

pnpm run dev

3. Open in Browser

Navigate to: http://localhost:5173

📸 Features

Real-time Face Detection - Detect faces through camera in real-time
Facial Landmark Tracking - Precise 68-point facial landmark localization
Confidence Display - Show confidence scores for each detection
Visual Interface - Beautiful UI with real-time rendering
CDN Model Loading - No manual model download required

💡 Usage Instructions

  1. Start Camera: Click the green "Start Camera" button
  2. Grant Permission: Allow browser camera access
  3. Face the Camera: Position your face in front of the camera
  4. Auto Detection: System automatically detects and marks faces

📁 Project Structure

face-recognition-app/
├── src/
│   ├── components/
│   │   └── FaceRecognition.tsx    # Core face recognition component
│   ├── types/
│   │   └── face-api.d.ts          # TypeScript type declarations
│   ├── App.tsx                     # Main application component
│   ├── App.css                     # Application styles
│   └── main.tsx                    # Entry point
├── public/
│   └── models/                     # Model files directory (optional)
├── scripts/
│   └── download-models.js          # Model download script
├── README.md                       # This file
└── vite.config.ts                  # Vite configuration

🔧 Tech Stack

  • React 19 - Latest version with React Compiler
  • TypeScript ~5.9 - Full type support
  • Vite ^8.0 - Lightning-fast development experience
  • face-api.js 0.22 - Face recognition library
  • pnpm - Fast package management

🌐 Deployment Recommendations

For production deployment:

  1. HTTPS Required - Camera access requires HTTPS
  2. Recommended Platforms:
    • Vercel (Recommended)
    • Netlify
    • Cloudflare Pages

⚠️ Important Notes

  • First Load: Downloads ~10MB model files from CDN
  • Network: Ensure stable internet connection
  • Browser: Requires MediaDevices API support
  • Privacy: All processing is done locally, no data uploaded

🎯 What's Next?

Extend this project with more features:

  1. Face Recognition & Matching - Register faces and verify identity
  2. Expression Recognition - Detect emotions like happiness, sadness
  3. Age & Gender Prediction - Estimate age range and gender
  4. Multi-face Tracking - Track multiple faces simultaneously
  5. Liveness Detection - Prevent photo spoofing

💬 FAQ

Q: Can't see camera feed?
A: Check if you've granted camera permissions and ensure you're using HTTPS or localhost

Q: Model loading fails?
A: Check network connection, CDN loading may take time on first load

Q: Slow detection performance?
A: Try reducing the inputSize parameter or use a device with better performance


Enjoy! 🎊

For issues, check the detailed documentation or browser console errors.

About

Face Recognition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors