π Click the preview above to view the SmartAttend demo workflow.
- π Student enrollment with face capture
- π§ CNN-based face recognition
- π‘οΈ Liveness detection against spoof attempts
- β Attendance verification using claimed roll number
- π Attendance logs, attempt logs, and analytics
- π Model evaluation reports including ROC metrics
SmartAttend is a Streamlit-based smart attendance system that combines:
- Face Recognition
- Liveness Detection
- SQLite-backed record management
- Admin-first classroom workflow
Traditional attendance systems ask:
βDid someone mark present?β
SmartAttend asks the better question:
βWas the real student physically present, and was the scan genuine?β
That is what makes this project stand out.
Traditional attendance workflows are weak because they often allow:
- Proxy attendance
- Manual verification overhead
- No verification of physical presence
- No fraud attempt tracking
- Poor auditability
SmartAttend fixes this by combining identity verification with anti-spoofing and structured logging.
- Enrolls students with a live face scan and academic details
- Stores student records in SQLite
- Verifies attendance using claimed roll number plus face scan
- Uses a CNN-based liveness model to reject spoof attempts
- Logs official attendance and separate verification attempts
- Shows roster data, attendance percentage, and model evaluation reports
- Admin logs into the Streamlit app
- Student is enrolled with face image, roll number, email, year, program, and course
- Face sample is saved and linked to the student record in SQLite
- Liveness dataset is collected from real and fake captures
- Face recognition and liveness models are trained locally
- Student scans again for attendance with the claimed roll number
- System detects the face, checks identity, runs liveness verification, and marks attendance
- Dashboard shows student records, attendance summaries, attempt logs, and evaluation reports
End-to-end SmartAttend pipeline covering enrollment, verification, training, storage, and reporting.
The system follows a modular AI attendance pipeline:
Admin / Faculty
β
Streamlit SmartAttend App
β
Enrollment Module + Attendance Verification Module
β
Face Detection
β
Face Recognition CNN + Liveness Detection CNN
β
Attendance Decision Engine
β
SQLite Database + Attempt Logs + Attendance Logs
β
Dashboard Reports + Evaluation Outputs
Separately:
Collected Face Samples
β
Face Training Pipeline
β
Trained Face Recognition Model
Collected Real / Fake Liveness Samples
β
Liveness Training Pipeline
β
Trained Liveness Detection Model
Prevents fake attendance attempts using:
- Printed photos
- Mobile replay attacks
- Non-live image spoofing
The system stores:
- Official attendance records
- Failed / suspicious verification attempts
This creates a much stronger audit trail.
Attendance is tied to:
- Claimed roll number
- Registered face data
- Live verification result
Admins can review:
- Student roster
- Attendance percentages
- Verification attempt logs
- Model evaluation outputs
Separate services handle:
- Enrollment
- Detection
- Recognition
- Liveness
- Logging
- Evaluation
This makes the project easier to extend and maintain.
- Python
- Streamlit
- TensorFlow / Keras
- OpenCV
- NumPy
- Pandas
- SQLite
- Matplotlib
| Metric | Value |
|---|---|
| Accuracy | Replace with actual value |
| Precision | Replace with actual value |
| Recall | Replace with actual value |
| F1 Score | Replace with actual value |
| ROC-AUC | Replace with actual value |
ROC curve for the liveness detection model. Replace with the real generated output from your evaluation pipeline.
SmartAttend/
|-- app.py
|-- Dockerfile
|-- requirements.txt
|-- README.md
|-- .streamlit/
| `-- config.toml
|-- docs/
| `-- project_blueprint.md
|-- artifacts/
| `-- .gitkeep
|-- assets/
| |-- university_logo.png
| |-- demo.gif
| `-- architecture.png
|-- data/
| |-- attendance/
| | `-- .gitkeep
| |-- faces/
| | `-- .gitkeep
| `-- liveness/
| |-- fake/
| | `-- .gitkeep
| `-- real/
| `-- .gitkeep
|-- models/
| `-- .gitkeep
|-- notebooks/
| `-- README.md
|-- scripts/
`-- src/
|-- attendance_logger.py
|-- attendance_service.py
|-- collect_faces.py
|-- config.py
|-- database.py
|-- detect_and_mark.py
|-- enrollment_service.py
|-- evaluate_models.py
|-- face_detector.py
|-- liveness.py
|-- liveness_dataset_service.py
|-- recognizer.py
|-- train_face_model.py
|-- train_liveness_model.py
|-- generate_roc.py
`-- utils.py
- Copy the example environment file and adjust the values you want to override:
Copy-Item .env.example .env- Create a virtual environment and install dependencies:
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt- Start the app:
streamlit run app.pySmartAttend now loads configuration from a local .env file automatically.
Important variables:
SMARTATTEND_ADMIN_USER: admin username shown on the login screenSMARTATTEND_ADMIN_PASSWORD: admin password used for the seeded admin accountSMARTATTEND_APP_TITLE: dashboard titleSMARTATTEND_DATA_DIR: base directory for SQLite data, face samples, and liveness samplesSMARTATTEND_MODELS_DIR: trained model storage directorySMARTATTEND_ARTIFACTS_DIR: evaluation output directorySMARTATTEND_DATABASE_PATH: SQLite database file pathSMARTATTEND_FACE_DETECTOR_BACKEND: detector backend, normallyautoSMARTATTEND_RECOGNITION_THRESHOLD: confidence threshold for accepted face recognition predictionsSMARTATTEND_LIVENESS_THRESHOLD: confidence threshold for accepted live-face predictionsSMARTATTEND_FACE_MATCHER_THRESHOLD: fallback matcher similarity threshold
For a new deployment, set a strong admin password before first run.
Train the face recognition model:
python -m src.train_face_model --epochs 20Train the liveness model:
python -m src.train_liveness_model --epochs 15Run evaluation:
python -m src.evaluate_modelsGenerate ROC curve:
python -m src.generate_roc- Username:
admin - Password:
admin123
These defaults are intended for local development only. Override them in .env for any real deployment.
This repository is intended to store source code and project structure. Personal face images, trained local models, SQLite databases, and generated artifacts are excluded from version control by default.
- Enrollment-first attendance workflow
- Optional MTCNN detector with Haar fallback
- CNN-based identity recognition
- CNN-based liveness detection
- SQLite-backed student, attendance, and attempt logs
- Dashboard reporting and model evaluation outputs
- Model quality depends on locally collected training data
- Attendance percentage is event-based, not class-session based
- Liveness robustness depends on collecting varied real and spoof samples
- Public datasets and pretrained models are not bundled in the repo
- Copy
.env.exampleto.env - Set your admin username and a strong admin password
- Install dependencies with
pip install -r requirements.txt - Start the app with
streamlit run app.py
Build the image:
docker build -t smartattend .Run the container with a persistent data, model, and artifact mount:
docker run --rm -p 8501:8501 --env-file .env -v "${PWD}\\data:/app/data" -v "${PWD}\\models:/app/models" -v "${PWD}\\artifacts:/app/artifacts" smartattendNotes:
- The host-mounted
datadirectory preserves the SQLite database and collected face/liveness samples - The host-mounted
modelsdirectory preserves trained CNN models - The host-mounted
artifactsdirectory preserves evaluation plots and reports - If you deploy to a cloud service, inject the same variables from
.env.exampleinto the platform secret or environment settings instead of committing.env
- Multi-classroom expansion
- Role-based access control
- Cloud deployment support
- Better attendance session modeling
- Stronger spoof datasets for real-world robustness
- Future migration from SQLite to a scalable managed database
- Potential use of embeddings and vector similarity search for larger deployments
This project can grow from a classroom demo into a more production-oriented biometric attendance platform.
|
Mitra Boga |
Yashweer Potelu |
Datla Akshith Varma |
Sindhura Peri |
This project is licensed under the MIT License. See LICENSE.
This repository demonstrates a real-world AI-powered attendance verification system using face recognition, liveness detection, secure logging, and a modular Streamlit-based workflow.