FaceAuth is a robust facial authentication system built with Flask, OpenCV, and deep learning techniques. It delivers seamless and secure access control for various applications, enabling user registration, facial recognition, and user management through an intuitive web interface.
- User Registration: Register new users by capturing multiple facial images.
- Facial Recognition: Authenticate users by comparing live camera feeds with registered data.
- User Management: View and delete registered users.
- Model Training: Automatically retrains when users are added or deleted.
- Secure Sessions: Uses Flask sessions for secure logins and dashboard access.
- Error Handling: Robust handling for camera, model, and file errors.
| 
- Clone the repository
git clone <your-repository-url> cd facial
- Create and activate a virtual environment
- Windows:
python -m venv venv .\venv\Scripts\activate
- macOS/Linux:
python -m venv venv source venv/bin/activate
- Windows:
- Install dependencies
pip install Flask opencv-python numpy
If you have issues with
opencv-python, trypip install opencv-python-headless. - Place pre-trained models
- Ensure
haarcascade_frontalface_default.xml(from OpenCV) is available and accessible by your script. Usually,cv2.data.haarcascadespoints to it.
- Ensure
- Activate your virtual environment (if not already active)
- Start the Flask app
python app.py
- Access the application
- Go to http://localhost:5000 in your web browser.
- Navigate to
/register - Enter a unique username
- Click “Start Face Scan” and center your face in the camera feed
- When enough images are captured, the system will train and confirm registration
- Go to
/recognize - Click “Start Recognition”
- If recognized, you’ll be redirected to your dashboard
- On the
/registerpage, view the user list - Click “Delete” to remove a user
- The model retrains or deletes files if no users remain
facial/
├── app.py # Main Flask app
├── recognize.py # Face recognition logic
├── templates/ # Web HTML templates
│ ├── index.html
│ ├── register.html
│ ├── recognize.html
│ └── dashboard.html
├── dataset/ # Captured images for each user
│ └── <username>/
│ ├── 1.jpg
│ └── ...
├── trained_model/ # Recognition model and labels
│ ├── trainer.yml
│ └── labels.txt
├── images/ # Screenshots/documentation images
│ ├── homepage.png
│ ├── registration_page.png
│ └── recognition_page.png
└── README.md
- Prefer
localhost:5000over127.0.0.1:5000for camera access - Ensure your webcam is properly connected
- Use Chrome or Firefox for best compatibility