Traditional roll-call attendance is slow, prone to proxy fraud, and a massive time-waster. A Face Recognition Attendance System automates this process using Computer Vision and Machine Learning — and it makes an incredibly impressive final year project for BTech CSE, IT, and MCA students.
A working, deployed face recognition system is one of the few projects that can create an audible reaction in the viva room when you demonstrate it. Examiners and recruiters see it and immediately understand that you have practical AI skills.
Here is everything you need to know to build this project from start to finish.
The first challenge is finding where a face is in a video frame. OpenCV's CascadeClassifier (using Haar features) or a deep learning MTCNN model scans the image and returns bounding box coordinates (x, y, w, h) around each detected face.
Once the face region is cropped, it is passed through a Deep Neural Network (DNN) that converts it into a 128-dimensional vector (also called a face embedding or face encoding). This is the mathematical "fingerprint" of that specific face.
The key insight: Two photos of the same person produce vectors that are very close together (small Euclidean distance). Two different people produce vectors that are far apart.
This is how the face_recognition library (built on top of dlib) works — it uses a pre-trained ResNet model to generate these 128D vectors.
When the system sees an unknown face, it generates the 128D embedding and compares it against all stored embeddings in the database. If the distance is below a threshold (typically 0.6), it's a match. The corresponding student's name and ID are returned.
[!NOTE]
For your viva: Be ready to explain the difference between face detection (finding the face) and face recognition (identifying the person). These are two different AI tasks!
students table: student_id, name, roll_number, department, face_encoding (stored as binary/BLOB)
attendance table: id, student_id (FK), date, time, status
import sqlite3, pickle
conn = sqlite3.connect('attendance.db')
cursor = conn.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS students (
student_id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL, roll_number TEXT UNIQUE,
department TEXT, face_encoding BLOB
)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS attendance (
id INTEGER PRIMARY KEY AUTOINCREMENT,
student_id INTEGER, date TEXT, time TEXT,
FOREIGN KEY (student_id) REFERENCES students(student_id)
)''')
conn.commit()
Wrap your Python logic in a modern Streamlit web dashboard:
import streamlit as st
import pandas as pd, sqlite3
from datetime import date
st.title("🎓 Face Recognition Attendance System")
tab1, tab2 = st.tabs(["📊 View Attendance", "👤 Register Student"])
with tab1:
selected_date = st.date_input("Select Date", date.today())
conn = sqlite3.connect('attendance.db')
df = pd.read_sql_query(
"SELECT s.name, s.roll_number, s.department, a.time FROM attendance a JOIN students s ON a.student_id = s.student_id WHERE a.date = ?",
conn, params=[str(selected_date)]
)
st.dataframe(df)
if not df.empty:
csv = df.to_csv(index=False)
st.download_button("📥 Export to CSV", csv, f"attendance_{selected_date}.csv")
with tab2:
name = st.text_input("Student Name")
roll = st.text_input("Roll Number")
dept = st.selectbox("Department", ["CSE", "IT", "MCA", "ECE", "Mechanical"])
if st.button("📷 Start Registration"):
register_student(name, roll, dept)
st.success(f"Student '{name}' registered!")
Need help setting up OpenCV and Python?
Computer vision environments are notoriously difficult to configure. Get our premium source code with a guaranteed working setup — we provide remote installation assistance included.
A Face Recognition Attendance System perfectly blends software engineering with practical AI. It is visually impressive during demonstrations, solves a genuine real-world problem, and shows you understand both Computer Vision concepts and software architecture. Follow this step-by-step guide to build a full-featured system that guarantees excellent marks in your project evaluation.