A modern React + TypeScript + Vite application integrated with face-api.js for real-time face recognition.
pnpm installpnpm run devNavigate to: http://localhost:5173
✅ 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
- Start Camera: Click the green "Start Camera" button
- Grant Permission: Allow browser camera access
- Face the Camera: Position your face in front of the camera
- Auto Detection: System automatically detects and marks faces
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
- 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
For production deployment:
- HTTPS Required - Camera access requires HTTPS
- Recommended Platforms:
- Vercel (Recommended)
- Netlify
- Cloudflare Pages
- 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
Extend this project with more features:
- Face Recognition & Matching - Register faces and verify identity
- Expression Recognition - Detect emotions like happiness, sadness
- Age & Gender Prediction - Estimate age range and gender
- Multi-face Tracking - Track multiple faces simultaneously
- Liveness Detection - Prevent photo spoofing
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.