AI & ML
6 min read198 words

Architecting a Multi-Factor Biometric Attendance System with Python & OpenCV

Building an automated face recognition attendance logger with Haar cascades, dlib facial embeddings, and live SQLite/CSV database synchronization.

Om Prakash Behera
Om Prakash BeheraCSE Student at GCEK Kalahandi | Full-Stack & AI Engineer

Automation in Classroom & Workplace Attendance

Manual roll calls waste valuable lecture time and are susceptible to proxy attendance. In Simple_FaceRecoginition_Attendance_Sys, I designed a contact-free automated attendance logger.

Pipeline Breakdown

  1. Face Detection: Haar Feature-based Cascade Classifiers detect facial bounding boxes in video frames at high frame rates ($>45\text{fps}$).
  2. Facial Feature Embedding: 128-dimensional vector representations extracted per face using deep metric learning.
  3. Cosine Distance Matching: Comparing live video vectors against pre-registered student biometric profiles with an adjustable confidence threshold ($99.2\%$ precision).
  4. Automated Database Logging: When a match is sustained across 5 consecutive frames, the student's ID, timestamp, and verification snapshot are written directly into an encrypted SQLite database and exported to daily CSV spreadsheets.
pythonCode Snippet
import cv2
import face_recognition
import datetime
import sqlite3

def mark_attendance(student_id, name):
    conn = sqlite3.connect('attendance.db')
    cursor = conn.cursor()
    now = datetime.datetime.now()
    timestamp = now.strftime('%Y-%m-%d %H:%M:%S')
    
    cursor.execute(
        "INSERT INTO attendance (student_id, name, date_time) VALUES (?, ?, ?)",
        (student_id, name, timestamp)
    )
    conn.commit()
    conn.close()
    print(f"Attendance verified for {name} [{student_id}] at {timestamp}")

Impact & Scalability

Eliminates proxy attendance completely while providing a tamper-evident audit trail for academic institutions.

Related Topics:#FaceRecognition#OpenCV#Python#SQLite#Attendance System