A real-time face recognition-based attendance system using Python, Streamlit, Redis, and InsightFace. This system detects faces, matches them with stored embeddings, and logs attendance in Redis.
- Face Registration: Users can register their faces and roles (e.g., Student, Teacher).
- Real-time Face Recognition: Detects faces and matches them with stored embeddings.
- Attendance Logging: Logs check-in and check-out times.
- Reporting Dashboard: View attendance logs and generate reports.
git clone https://github.com/yourusername/face-recognition-attendance-system.git
cd face-recognition-attendance-systemFor consistent and reproducible results, it's recommended to use a virtual environment.
- Open the terminal.
- Navigate to the project directory:
cd /path/to/project - Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate - Install required dependencies:
pip install -r requirements.txt
- Open the Command Prompt or PowerShell.
- Navigate to the project directory:
cd \path\to\project
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
venv\Scripts\activate
- Install required dependencies:
pip install -r requirements.txt
- Create a
.envfile using the example template:
cp .env.example .env- Open the
.envfile and set your Redis credentials:
REDIS_HOST=your-redis-host
REDIS_PORT=your-redis-port
REDIS_PASSWORD=your-redis-password
streamlit run Home.pyThis will start the Streamlit application. Access it at:
http://localhost:8501
📦 face-recognition-attendance-system
┣ 📂 insightface_model/ # Pretrained InsightFace models
┣ 📂 pages/ # Streamlit pages (Real-time Prediction, Reports)
┣ 📜 face_rec.py # Core face recognition logic
┣ 📜 Home.py # Main Streamlit dashboard
┣ 📜 Report.py # Attendance reporting module
┣ 📜 requirements.txt # Dependencies
┣ 📜 .env # Redis credentials (not in Git)
┣ 📜 .env.example # Example env file (in Git)
┗ 📜 README.md # Project documentation
- Users register their face using the camera.
- The system extracts facial embeddings using InsightFace.
- The extracted embeddings are stored in Redis under the key
academy:register.
- The camera captures faces and extracts facial embeddings.
- The system compares these embeddings with stored embeddings in Redis.
- If a match is found, attendance is logged in Redis under
attendance:logs.
- When a person is detected, an entry is logged as:
Name@Role@Timestamp - Redis stores this in a list under
attendance:logs.
- Users can view attendance logs in the Reports tab.
- The system generates a detailed attendance report, including:
- Check-in time
- Check-out time
- Duration spent
- Start real-time face recognition.
- View detected faces and their roles.
- View registered users.
- Refresh and check attendance logs.
- Generate attendance reports.
- Add a database backup mechanism.
- Integrate with cloud storage for model updates.
- Improve face recognition accuracy with better embeddings.
- Chaitanya Malani (Lead Developer)
For any issues, please raise a GitHub issue or contact me.