AI-Powered Exam Integrity Guardian: Real-Time Classroom Cheating Detection System Using YOLOv8 and Pose Estimation
Back to ProjectFollow this comprehensive step-by-step guide to install and configure the AI-Powered Classroom Cheating Detection System on your local machine. The setup process takes approximately 15-20 minutes.
Before starting, ensure Python is properly installed on your system. Open your terminal or command prompt and run:
python --version
You should see output like Python 3.8.x or higher. If Python is not installed, download it from python.org and install with the "Add to PATH" option enabled.
Verify pip installation:
pip --version
Open your terminal or command prompt and navigate to the directory where you want to install the project:
cd Desktop
Clone the project repository (or extract the ZIP file if downloaded):
git clone [repository-url]
Navigate into the project directory:
cd "cheating detection"
Creating a virtual environment isolates project dependencies from your system Python installation, preventing conflicts with other projects.
Create the virtual environment:
python -m venv venv
Activate the virtual environment:
venv\Scripts\activatesource venv/bin/activate
Once activated, you'll see (venv) prefix in your terminal prompt.
Install all required Python packages using the provided requirements file:
pip install -r requirements.txt
This command installs the following core packages:
The installation process may take 5-10 minutes depending on your internet speed. If you encounter any errors, try upgrading pip first:
pip install --upgrade pip
The system uses pre-trained YOLOv8 models for detection. These models will be automatically downloaded on first run, but you can pre-download them to save time:
python -c "from ultralytics import YOLO; YOLO('yolov8n.pt'); YOLO('yolov8n-pose.pt')"
This downloads two models:
Models are cached in ~/.ultralytics/ directory and reused across sessions.
Initialize the SQLite database and create necessary tables by running Django migrations:
python manage.py migrate
You should see output confirming the creation of tables for:
Create a superuser account to access the Django admin panel for advanced configuration:
python manage.py createsuperuser
You'll be prompted to enter:
After creating the superuser, you can access the admin panel at http://127.0.0.1:8000/admin/
To enable email alerts for detected cheating incidents, configure SMTP settings in the Django settings file.
Open cheating_detector/settings.py in a text editor and locate the email configuration section:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com' # Change to your SMTP server
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com' # Your email
EMAIL_HOST_PASSWORD = 'your-app-password' # Your password or app password
DEFAULT_FROM_EMAIL = 'your-email@gmail.com'
Gmail Users: For Gmail accounts, you need to generate an App Password:
Other Email Providers: Update EMAIL_HOST and EMAIL_PORT according to your provider's SMTP settings.
Customize detection sensitivity and thresholds based on your specific requirements. In cheating_detector/settings.py, find the DETECTION_SETTINGS dictionary:
DETECTION_SETTINGS = {
'CONFIDENCE_THRESHOLD': 0.5, # Min confidence for object detection (0.0-1.0)
'POSE_CONFIDENCE': 0.6, # Min confidence for pose estimation (0.0-1.0)
'POSITION_THRESHOLD': 100, # Max pixels from seat position
'HAND_PROXIMITY_THRESHOLD': 80, # Pixels for document passing detection
'POSTURE_ANGLE_THRESHOLD': 30, # Degrees for abnormal posture
}
Recommended settings for different scenarios:
Create directories for storing uploaded videos and processed outputs:
python manage.py collectstatic --noinput
The system automatically creates the following directories:
media/uploads/ - Stores uploaded video filesmedia/processed/ - Stores processed videos with detection overlaysmedia/screenshots/ - Stores incident screenshotsLaunch the Django development server:
python manage.py runserver 8000
You should see output similar to:
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
The server is now running and ready to accept requests.
Open your web browser and navigate to:
http://127.0.0.1:8000/
You'll see the beautiful glassmorphism dashboard with animated Three.js background. The application includes these main sections:
Verify that all features are working correctly:
python manage.py runserver 8080netstat -ano | findstr :8000 then taskkill /PID [number] /Flsof -ti:8000 | xargs kill -9For deploying to a production environment, follow these additional steps:
# In settings.py
DEBUG = False
ALLOWED_HOSTS = ['yourdomain.com', 'www.yourdomain.com']
SECRET_KEY = 'generate-new-secret-key' # Use environment variable
Replace SQLite with PostgreSQL or MySQL for better performance:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'cheating_detection',
'USER': 'your_db_user',
'PASSWORD': 'your_db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}
Use Gunicorn as WSGI server:
pip install gunicorn
gunicorn cheating_detector.wsgi:application --bind 0.0.0.0:8000
Configure Nginx to handle static files and proxy requests to Gunicorn:
server {
listen 80;
server_name yourdomain.com;
location /static/ {
alias /path/to/project/staticfiles/;
}
location /media/ {
alias /path/to/project/media/;
}
location / {
proxy_pass http://127.0.0.1:8000;
}
}
Install SSL certificate using Let's Encrypt:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
To monitor multiple examination rooms simultaneously:
pip install --upgrade -r requirements.txt
# Update all packages
pip install --upgrade ultralytics opencv-python Django
# Clear detection logs older than 30 days
python manage.py shell -c "from detection.models import Detection; Detection.objects.filter(timestamp__lt=datetime.now()-timedelta(days=30)).delete()"
# Backup database
python manage.py dumpdata > backup.json
# Restore database
python manage.py loaddata backup.json
# Check system health
python manage.py check
# View application logs
tail -f logs/django.log
Expected performance on different hardware configurations:
| Hardware | FPS (Live) | Processing Speed |
|---|---|---|
| Intel i5, 8GB RAM, No GPU | 10-15 FPS | 2x video duration |
| Intel i7, 16GB RAM, No GPU | 20-25 FPS | 1.5x video duration |
| AMD Ryzen 7, 16GB RAM, GTX 1660 | 30-40 FPS | Real-time processing |
| Intel i9, 32GB RAM, RTX 3070 | 50-60 FPS | 0.5x video duration |
If you encounter issues not covered in this guide:
Our team is here to assist you with installation and setup.