Documentation

Installation Guide

AI-Powered Student Engagement Monitoring System with Real-Time Analytics

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Complete Installation and Setup Guide

Prerequisites

  • Python 3.8 or higher installed on your system
  • pip package manager
  • 4GB RAM minimum (8GB recommended)
  • 500MB free disk space for dependencies
  • Redis server (optional, for background processing)
  • Basic knowledge of command line interface

Step-by-Step Installation

Step 1: Clone or Extract the Project

Navigate to the project directory in your terminal or command prompt:

cd "c:\Users\Admin\Desktop\cccoddee\students Emgaments Detection"

For Mac/Linux users, use forward slashes in the path.

Step 2: Activate Virtual Environment

For Windows:

.\venv\Scripts\activate

For Mac/Linux:

source venv/bin/activate

You should see (venv) prefix in your command prompt after activation.

Step 3: Install Required Dependencies

Install all necessary packages using pip:

pip install -r requirements.txt

This will install Django 4.2, YOLOv8, MediaPipe, OpenCV, Celery, and all other dependencies. Installation may take 5-10 minutes.

Key packages that will be installed:

  • Django 4.2 - Web framework
  • ultralytics - YOLOv8 for object detection
  • mediapipe - Pose estimation
  • opencv-python - Computer vision library
  • Pillow - Image processing
  • celery - Async task processing
  • redis - Cache and message broker

Step 4: Database Setup

Create database tables by running migrations:

python manage.py makemigrations
python manage.py migrate

This creates tables for students, video sessions, analytics, and user authentication.

Step 5: Create Superuser Account

Create an admin account to access the Django admin panel:

python manage.py createsuperuser

You will be prompted to enter:

  • Username (e.g., admin)
  • Email address (optional)
  • Password (enter twice for confirmation)

Remember these credentials - you'll need them to access the admin panel.

Step 6: Collect Static Files (Production Only)

If deploying to production, collect all static files:

python manage.py collectstatic

For development, this step is optional.

Step 7: Start Development Server

Launch the Django development server:

python manage.py runserver

The application will be available at:

http://127.0.0.1:8000/

Keep this terminal window open while using the application.

Step 8: Access Admin Panel

Open your web browser and navigate to:

http://127.0.0.1:8000/admin/

Login using the superuser credentials you created in Step 5.

Step 9: Add Students to Database

In the admin panel:

  1. Click on "Students" section
  2. Click "Add Student" button
  3. Fill in student details:
    • Student ID (unique identifier)
    • Student Name
    • Upload student photo (optional but recommended)
    • Set seating position (row and column numbers)
  4. Click "Save" to add the student
  5. Repeat for all students in the classroom

Accurate seating positions improve tracking accuracy.

Step 10: Configure Project Settings

Open engagement_monitor/settings.py to customize:

Database Configuration:
# For SQLite (default)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

# For PostgreSQL (production)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'engagement_db',
        'USER': 'your_username',
        'PASSWORD': 'your_password',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}
Media Upload Limits:
DATA_UPLOAD_MAX_MEMORY_SIZE = 524288000  # 500MB
FILE_UPLOAD_MAX_MEMORY_SIZE = 524288000  # 500MB
Frame Processing Rate:
# Process every Nth frame (higher = faster but less accurate)
PROCESS_EVERY_N_FRAMES = 5  # Default: 5

Step 11: Optional - Setup Background Processing

For production environments handling multiple large videos:

Install Redis:

Windows: Download from redis.io

Mac: brew install redis

Linux: sudo apt-get install redis-server

Start Redis Server:
redis-server
Start Celery Worker (in new terminal):
celery -A engagement_monitor worker -l info

This enables asynchronous video processing for better performance.

Step 12: Upload and Analyze Video

  1. Navigate to the "Upload Video" page in the web interface
  2. Enter a session title (e.g., "Mathematics Class - Grade 10 - January 5")
  3. Click "Choose File" or drag and drop your classroom video
  4. Supported formats: MP4, AVI, MOV, MKV
  5. Maximum file size: 500MB
  6. Click "Start Analysis" button

Ensure the video has good lighting and clear view of students for best results.

Step 13: Monitor Processing Status

After uploading, you'll be redirected to the processing status page where you can:

  • View real-time progress percentage
  • See current frame being processed
  • Monitor detection events in real-time
  • Estimated time remaining

Processing time varies based on video length and system specs. A 10-minute video typically takes 3-5 minutes.

Step 14: View Results and Analytics

Once processing completes, access the results dashboard to view:

  • Behavior distribution pie chart (mobile usage, sleeping, talking, etc.)
  • Engagement timeline graph showing activity over time
  • Student-wise breakdown with individual metrics
  • Session summary with overall statistics
  • Heatmaps showing attention patterns

Step 15: Generate and Download Reports

From the results page, you can:

  • Click "Generate PDF Report" for a professional PDF document
  • Click "Generate Excel Report" for detailed data analysis
  • Download processed video with annotations
  • Share reports with teachers, parents, or administrators

Reports include charts, statistics, and recommendations for improving engagement.

Troubleshooting Common Issues

Issue: Video Upload Fails

Possible Causes:

  • File size exceeds 500MB limit
  • Unsupported video format
  • Network timeout during upload

Solutions:

  • Compress the video using HandBrake or similar tools
  • Convert to MP4 format using FFmpeg
  • Split large videos into smaller segments
  • Increase timeout settings in settings.py

Issue: Processing Stuck or Taking Too Long

Solutions:

  • Use shorter video clips for testing (5-10 minutes recommended)
  • Increase PROCESS_EVERY_N_FRAMES value in settings.py
  • Ensure sufficient RAM is available (close other applications)
  • Check if GPU acceleration is enabled for faster processing
  • Enable background processing with Celery for large videos

Issue: Static Files Not Loading (CSS/JS broken)

Solutions:

python manage.py collectstatic --clear
python manage.py collectstatic

Then restart the development server.

Issue: Database Errors

Solutions:

python manage.py makemigrations
python manage.py migrate --run-syncdb

If issues persist, delete db.sqlite3 and run migrations again (note: this will delete all data).

Issue: Poor Detection Accuracy

Solutions:

  • Ensure classroom has adequate lighting
  • Position camera to capture all students clearly
  • Avoid camera angles with too much obstruction
  • Use higher resolution videos (720p or 1080p recommended)
  • Update seating positions in admin panel for accurate student mapping
  • Lower PROCESS_EVERY_N_FRAMES for more accurate tracking

Issue: Module Import Errors

Solutions:

pip install --upgrade pip
pip install -r requirements.txt --force-reinstall

Ensure virtual environment is activated before installing packages.

Issue: Permission Denied Errors

Solutions:

  • Run terminal/command prompt as administrator (Windows)
  • Use sudo for installation commands (Mac/Linux)
  • Check folder permissions for media directory
  • Ensure write permissions for database file

Performance Optimization Tips

  • GPU Acceleration: Install CUDA toolkit for NVIDIA GPUs to speed up YOLOv8 inference by 10-20x
  • Frame Rate Adjustment: Increase PROCESS_EVERY_N_FRAMES to 10-15 for faster processing with minimal accuracy loss
  • Video Preprocessing: Reduce video resolution to 720p before upload for faster processing
  • Database Optimization: Use PostgreSQL instead of SQLite for production deployments
  • Caching: Enable Redis caching for frequently accessed data
  • Batch Processing: Process multiple videos during off-peak hours using Celery

Additional Configuration Options

Confidence Threshold Adjustment

In monitoring/detector.py, adjust detection confidence:

# Lower values = more detections (may include false positives)
# Higher values = fewer detections (more accurate)
DETECTION_CONFIDENCE = 0.5  # Range: 0.1 to 0.9

Email Notifications Setup

Configure email settings in settings.py for report delivery:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-app-password'

Allowed Video Formats

Modify monitoring/models.py to add more video formats:

ALLOWED_EXTENSIONS = ['mp4', 'avi', 'mov', 'mkv', 'wmv', 'flv']

Best Practices for Optimal Results

  • Use videos with good lighting and minimal camera shake
  • Position camera to capture all students with minimal obstruction
  • Update student seating arrangements regularly in admin panel
  • Process shorter video segments (10-15 minutes) for faster results
  • Maintain consistent camera angle throughout the session
  • Use 720p or 1080p resolution for best detection accuracy
  • Avoid recordings with excessive glare or shadows
  • Ensure camera is stable and not moving during recording
  • Test with sample videos before processing important sessions
  • Regularly backup database and generated reports

Need Help?

If you encounter any issues during installation or usage:

  • Check the Django server console output for error messages
  • Review the Admin Panel logs for detailed error information
  • Verify media folder permissions for upload and storage
  • Ensure all prerequisites are properly installed
  • Contact CodeAj support for project setup assistance
  • Visit CodeAj Project Setup Services for professional help

CodeAj offers complete project setup, source code explanation, and custom modifications as addon services.

What's Next?

After successful installation, explore these features:

  • Experiment with different confidence thresholds for detection
  • Customize the UI colors and branding in static/css files
  • Add custom behavior detection models
  • Integrate with existing Learning Management Systems
  • Implement face recognition for automatic student identification
  • Set up automated email reports to teachers and parents
  • Deploy to production server with proper security measures

For custom features and modifications, visit CodeAj Services for idea implementation and project customization.

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us
Chat with us