Skip to content

roger18gm/eduvision

Repository files navigation

EduVision: AI-Powered Campus Analytics System

Purpose and Scope

This document provides a comprehensive introduction to the EduVision system, an AI-powered desktop application designed for real-time campus occupancy monitoring and analytics. It covers the high-level architecture, core subsystems, and how they integrate to deliver automated people counting, data visualization, and scheduled snapshot capture.

The Problem We Solve

Universities face a critical challenge: lack of comprehensive data. Without this crucial attendance data, institutions struggle to:

  • Predict course demand and optimize class scheduling
  • Allocate resources effectively across departments
  • Identify patterns in student attendance behavior
  • Make data-driven decisions about curriculum planning
  • Forecast enrollment trends and capacity needs

EduVision addresses this gap by providing automated, real-time attendance tracking and analytics that enable universities to:

  • Build predictive models for future course planning
  • Optimize classroom utilization
  • Track attendance patterns across different courses and time periods
  • Generate insights for academic planning and resource allocation
  • Support evidence-based decision making for faculty and administration

System Overview

EduVision is a desktop application built with PyQt5 that leverages YOLOv8 for real-time people detection in campus environments. The system captures live camera feeds, processes them through a deep learning pipeline, and stores occupancy data for analytics and reporting.

System Architecture

Key Capabilities

Capability Description
Real-time Detection Continuously processes camera feeds using YOLO to count people in rooms
Multi-Camera Support Detects and switches between multiple camera devices
Analytics Dashboard Visualizes occupancy trends with Matplotlib/Seaborn charts
Automated Snapshots Schedules periodic data capture at hourly, daily, or custom intervals
Role-Based Access Implements user authentication with bcrypt password hashing
Campus Mapping Models buildings, rooms, courses, and class schedules in SQLite

Architecture Overview

Computer Vision System

The PeopleCounter class serves as the machine learning inference layer in the EduVision computer vision pipeline. It encapsulates YOLO model initialization, frame-by-frame person detection, visual annotation, and performance monitoring.

Computer Vision Pipeline

Key Responsibilities

Responsibility Description
Model Management Load and maintain YOLO model instance with configurable model weights
Person Detection Identify people in video frames using YOLO inference
Count Tracking Maintain current person count from the most recent frame
Frame Annotation Draw bounding boxes and confidence labels on detected persons
Performance Monitoring Calculate and track frames per second (FPS) for performance metrics

Model Selection Guidelines

Use Case Recommended Model Rationale
Initial deployment yolov8n.pt Pre-trained, general-purpose, no training required
Production campus monitoring best.pt Fine-tuned on campus environment, better accuracy
Testing/comparison Both models Evaluate performance difference

Fine-tuned Model Performance:

  • Accuracy: 90% at 15 epochs
  • Training: Custom dataset optimized for campus environments
  • Improvement: Better detection accuracy compared to base YOLOv8n model
  • Note: Could be trained further for even better performance

Fine-tuning Process:

  • Notebook: YOLO Person Recognition on Kaggle
  • Dataset: Custom campus environment dataset
  • Training: 15 epochs with 90% accuracy achieved
  • Model File: Download best.pt from the notebook output

Model Performance Comparison

Our fine-tuned model significantly outperforms the original YOLOv8n model in campus environments:

Original vs Fine-tuned Model Comparison Original vs Fine-tuned Model Comparison

Why Our Fine-tuned Model is Better:

  1. Campus-Specific Training: Trained on real campus scenarios with diverse lighting, angles, and crowd densities
  2. Higher Accuracy: 90% accuracy vs ~75% for base YOLOv8n in campus settings
  3. Better Detection in Crowded Scenes: Improved performance when multiple people are present
  4. Optimized for Classroom Environments: Specifically tuned for typical classroom layouts and furniture
  5. Reduced False Positives: Better at distinguishing people from objects in educational settings
  6. Improved Confidence Scores: More reliable confidence thresholds for attendance tracking

Performance Metrics:

  • Detection Accuracy: 90% (vs 75% base model)
  • False Positive Rate: 5% (vs 15% base model)
  • Processing Speed: Maintains real-time performance
  • Campus Environment Accuracy: 95% in typical classroom settings

Authentication System

The Authentication System provides credential verification and role-based access control (RBAC) for the EduVision application. Features include:

  • Password Security: bcrypt hashing for secure credential storage
  • Role-Based Access: Different permission levels for users
  • Session Management: Secure login/logout functionality
  • Integration: Seamless connection with Login UI

Database Documentation

Overview

This document describes the database schema for the course scheduling and room management system. The system manages users, roles, buildings, rooms, courses, class schedules, and raw occupancy data.

Database Schema

Login Module

Table: role

Defines user roles and permissions within the system.

Column Type Constraints Description
role_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each role
name VARCHAR(45) NOT NULL UNIQUE Role name (e.g., Admin, Faculty, Student, Staff)

Relationships:

  • One-to-Many with user table

Table: user

Stores user account information for system authentication and authorization.

Column Type Constraints Description
user_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each user
username VARCHAR(100) NOT NULL UNIQUE User's login name
password VARCHAR(300) NOT NULL Encrypted password for authentication
role_id INTEGER FOREIGN KEY, NOT NULL References role table

Relationships:

  • Many-to-One with role table (ON DELETE RESTRICT, ON UPDATE CASCADE)

Data Module

Table: building

Contains information about campus buildings.

Column Type Constraints Description
building_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each building
name VARCHAR(200) NOT NULL UNIQUE Building name (e.g., Smith Building, Snow Building)

Relationships:

  • One-to-Many with room table

Table: room

Stores details about individual rooms within buildings.

Column Type Constraints Description
room_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each room
number VARCHAR(20) NOT NULL Room number within the building (e.g., "101", "Lab-210")
building_id INTEGER FOREIGN KEY, NOT NULL References building table
capacity INTEGER CHECK(capacity > 0) Maximum occupancy capacity of the room

Relationships:

  • Many-to-One with building table (ON DELETE RESTRICT, ON UPDATE CASCADE)
  • One-to-Many with class_schedule table
  • One-to-Many with raw_data table

Additional Constraints:

  • UNIQUE constraint on (building_id, number) combination

Table: course

Contains course information offered by the institution.

Column Type Constraints Description
course_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each course
course_code VARCHAR(100) NOT NULL UNIQUE Official course code (e.g., CIT 111, MATH 112)
name VARCHAR(100) NOT NULL Course name
instructor VARCHAR(200) Instructor name for the course
department VARCHAR(200) Academic department offering the course

Relationships:

  • One-to-Many with class_schedule table

Table: class_schedule

Manages scheduled class sessions linking courses to rooms and time slots.

Column Type Constraints Description
class_schedule_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each scheduled class
room_id INTEGER FOREIGN KEY, NOT NULL References room table
course_id INTEGER FOREIGN KEY, NOT NULL References course table
day_of_week VARCHAR(1) NOT NULL, CHECK(IN 'M','T','W','R','F') Day when class meets (M=Monday, T=Tuesday, W=Wednesday, R=Thursday, F=Friday)
start_time TIME NOT NULL Class start time (format: HH:MM:SS)
end_time TIME NOT NULL Class end time (format: HH:MM:SS)
semester VARCHAR(10) NOT NULL, CHECK(IN 'Fall','Winter','Spring','Summer') Academic term (Fall, Winter, Spring, Summer)
year INTEGER NOT NULL Academic year (e.g., 2024, 2025)
start_date DATE Semester start date (format: YYYY-MM-DD)
end_date DATE Semester end date (format: YYYY-MM-DD)

Relationships:

  • Many-to-One with room table (ON DELETE RESTRICT, ON UPDATE CASCADE)
  • Many-to-One with course table (ON DELETE RESTRICT, ON UPDATE CASCADE)

Additional Constraints:

  • CHECK constraint: start_time < end_time

Table: raw_data

Stores raw occupancy data collected from sensors or manual counts.

Column Type Constraints Description
data_id INTEGER PRIMARY KEY AUTOINCREMENT Unique identifier for each data entry
room_id INTEGER FOREIGN KEY, NOT NULL References room table
room_count INTEGER NOT NULL, CHECK(room_count >= 0) Number of people counted in the room
timestamp DATETIME NOT NULL, DEFAULT CURRENT_TIMESTAMP Date and time of the data collection

Relationships:

  • Many-to-One with room table (ON DELETE CASCADE, ON UPDATE CASCADE)

Entity Relationships

Key Relationships Summary

  1. User Authentication Flow:

    • userrole: Each user is assigned one role that determines their permissions
  2. Physical Infrastructure:

    • buildingroom: Buildings contain multiple rooms
  3. Academic Scheduling:

    • courseclass_schedule: Courses are scheduled into specific time slots
    • roomclass_schedule: Rooms host scheduled classes
    • Both course and room information combine to create the complete class schedule
  4. Occupancy Tracking:

    • roomraw_data: Rooms have occupancy data collected over time

Automation System

The automation system provides scheduled data capture and analysis capabilities:

Automation System

Key Features:

  • Scheduled Snapshots: Automated data collection at configurable intervals
  • Data Persistence: Long-term storage of attendance patterns
  • Analytics Integration: Automatic generation of attendance reports
  • Flexible Scheduling: Hourly, daily, or custom interval options

Analytics and Data Insights

EduVision provides powerful analytics capabilities to help universities make data-driven decisions:

Attendance Analytics

  • Real-time Attendance Tracking: Monitor class attendance as it happens
  • Historical Data Analysis: Track attendance patterns over time
  • Course Performance Metrics: Identify which classes have consistent attendance
  • Trend Analysis: Spot patterns in student attendance behavior

Predictive Capabilities

  • Future Course Planning: Use historical data to predict course demand
  • Resource Allocation: Optimize classroom and faculty assignments
  • Enrollment Forecasting: Predict which courses will be popular
  • Capacity Planning: Determine optimal class sizes and scheduling

Data Collection

  • Automated Snapshots: Capture attendance data at scheduled intervals
  • Machine Learning Dataset: Build comprehensive datasets for future ML models
  • Long-term Analytics: Track attendance trends across semesters and years

Testing and Development

Testing Scripts

The EduVision project includes comprehensive testing utilities for validating computer vision functionality:

Script Purpose Key Features Usage
simple_camera_compare.py Compare YOLOv8n vs fine-tuned models Side-by-side detection comparison, real-time switching, confidence threshold 0.5 Run directly from command line
starter.py Test integrated people counter Full PeopleCounter integration, camera switching, counter reset Run directly from command line

Both scripts operate independently of the main application and provide keyboard controls for interactive testing.

How to Run the Program

Prerequisites

pip install -r requirements.txt

Quick Start

# Run the main application
python main.py

Pyinstaller executable

pyinstaller main.py --onedir --add-data "database;database" --add-data "best.pt;." --name "EduVision"

Default Login Credentials:

  • Username: admin2
  • Password: 1234

Testing and Development

# Test camera functionality
python testing/starter.py

# Compare models (requires best.pt)
python testing/simple_camera_compare.py

Future Work

Short-term Enhancements

  • Extended Training: Train the fine-tuned model for more epochs to improve accuracy beyond 90%
  • Multi-Class Detection: Expand beyond person detection to include objects like laptops, books, etc.
  • Real-time Alerts: Implement notifications for unusual attendance patterns
  • Mobile Integration: Develop companion mobile app for faculty

Long-term Vision

  • Predictive Analytics: Build ML models to forecast attendance and enrollment
  • Integration APIs: Connect with existing university systems (LMS, scheduling)
  • Advanced Analytics: Implement time-series analysis for attendance trends
  • Scalability: Support for multiple campuses and distributed systems
  • AI Insights: Automated recommendations for course scheduling and resource allocation

Research Opportunities

  • Behavioral Analysis: Study patterns in student attendance and engagement
  • Optimization Algorithms: Develop algorithms for optimal class scheduling
  • Predictive Modeling: Create models to predict course success based on attendance
  • Resource Optimization: AI-driven recommendations for facility and faculty allocation

Technical Architecture

For detailed information about specific subsystems, refer to:

  • Frontend GUI architecture: Frontend Architecture
  • Computer vision and ML inference: Computer Vision System
  • Data persistence and schema: Database Layer
  • User authentication and RBAC: Authentication System
  • Scheduled snapshot automation: Automation System
  • Development workflows and testing: Development and Testing

Contributors

Christian Mijangos

Roger Galan

Vinnicius Castro

Contributing

We welcome contributions to improve EduVision's capabilities in campus analytics and predictive modeling. Areas of particular interest include:

  • Enhanced computer vision models
  • Advanced analytics algorithms
  • User interface improvements
  • Integration with university systems
  • Performance optimization

EduVision: Transforming campus data into actionable insights for the future of education.

About

Download Eduvison, a computer vision attendance program that is meant to facilitate occupany prediction for campus facilities

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages