A modern, full-stack student attendance system using Python, Flask, and face recognition — designed as a polished college project demonstration.
| Feature | Description |
|---|---|
| 📸 Upload Photo | Upload any image; the system detects & marks all recognised students |
| 🎥 Live Camera | Real-time webcam stream with face detection overlays |
| 📋 Attendance Log | Searchable, filterable table saved to attendance.csv |
| 👥 Student Roster | Live presence indicators that update automatically |
| 💡 Toast Alerts | Animated notifications for every recognition event |
| 🔄 Reset & Export | One-click CSV export and attendance reset |
face_attendance_app/
│
├── app.py ← Flask backend (routes + face recognition)
├── generate_placeholder_dataset.py ← Generates demo student images
├── attendance.csv ← Auto-generated attendance log
├── requirements.txt ← Python dependencies
│
├── dataset/
│ ├── alice.jpg
│ ├── bob.jpg
│ ├── charlie.jpg
│ ├── david.jpg
│ └── emma.jpg
│
├── static/
│ ├── style.css ← Dark-tech UI stylesheet
│ └── script.js ← Frontend logic (fetch, DOM, toasts)
│
└── templates/
└── index.html ← Jinja2 dashboard template
Make sure you have:
- Python 3.9 – 3.11 (face_recognition has limited support on 3.13; 3.10/3.11 recommended)
- pip (latest)
- CMake (required by dlib, which face_recognition depends on)
Install CMake if missing:
# macOS
brew install cmake
# Ubuntu / Debian
sudo apt-get install cmake build-essential
# Windows — download from https://cmake.org/download/Place the face_attendance_app/ folder anywhere on your machine and open a terminal inside it:
cd face_attendance_apppython -m venv venv
# Activate:
# macOS / Linux
source venv/bin/activate
# Windows
venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txt
dlib(a dependency offace_recognition) compiles from source and may take 2–5 minutes.
On Windows you may need Microsoft Visual C++ Build Tools.
Option A — Use the auto-generated placeholders (demo only)
python generate_placeholder_dataset.pyThis creates stylised placeholder images in dataset/. They demonstrate the UI flow but will not produce accurate recognition since they don't contain real human faces.
Option B — Add real photos (recommended for actual demos)
Place one clear, front-facing photo of each student in the dataset/ folder:
dataset/
alice.jpg ← real photo of Alice
bob.jpg ← real photo of Bob
charlie.jpg
david.jpg
emma.jpg
Tips for best recognition accuracy:
- Well-lit, front-facing photo
- Only one face per file
- JPG or PNG format
- At least 200×200 pixels
python app.pyYou should see:
=======================================================
AI Face Recognition Attendance System
=======================================================
[OK] Loaded face for: Alice
[OK] Loaded face for: Bob
...
[INFO] 5 student(s) loaded from dataset/
* Running on http://0.0.0.0:5000
Navigate to: http://localhost:5000
- Click "Upload Photo" in the Quick Actions panel
- Select an image containing one or more student faces
- The system will:
- Detect all faces in the image
- Match them against the known students
- Draw green bounding boxes with names
- Automatically mark matched students as "Present"
- Show toast notifications for each result
- Click "Start Camera" — your webcam will activate
- Students who appear in the camera view are automatically marked Present
- The
RECindicator in the viewport turns red when live - Click "Stop Camera" to release the webcam
- Records appear in the right-hand panel with name, time, and date
- Use the search bar to filter by student name
- Use the date dropdown to view a specific day
- Click "Export CSV" to download
attendance.csv
- Click "Reset Records" and confirm to wipe all attendance data
| Setting | Location | Default |
|---|---|---|
| Face match threshold | app.py → recognize_faces_in_image() |
0.55 |
| Camera resolution | app.py → camera_worker() |
640×480 |
| Max upload size | app.py → MAX_CONTENT_LENGTH |
16 MB |
| Port | app.py → last line |
5000 |
dlib fails to install
→ Install CMake and C++ build tools (see Step 1)
→ Or try: pip install dlib --find-links https://github.com/z-mahmud22/Dlib_Windows_Python3.x
"No module named face_recognition"
→ Make sure your virtual environment is activated
→ Re-run pip install face_recognition
Camera not opening
→ Check that no other app is using the webcam
→ On Linux, you may need sudo or to add yourself to the video group
No faces detected in uploaded image
→ Ensure the photo is well-lit and front-facing
→ The system uses HOG-based detection (fast but needs clear faces)
flask — Web framework
opencv-python — Image processing & webcam capture
face-recognition — Face detection & recognition (wraps dlib)
numpy — Array operations
pandas — CSV attendance management
Pillow — Image generation for placeholders
- Each student is marked Present only once per day (duplicates are prevented)
- Attendance is saved in
attendance.csvin the format:Name | Time | Date | Status - The system runs entirely locally — no cloud or internet required
- Replace placeholder images with real photos for actual use