This repository contains the Stress Detection Module, a key component of the AI-Based Stress Detection System for University Students. This module is responsible for analyzing facial expressions and determining whether a student is stressed or not. It uses deep learning techniques to classify emotions and assess stress levels in real time.
- Facial Expression Analysis – Uses convolutional neural networks (CNNs) to classify emotions.
- Stress Classification – Determines if a student is stressed or not stressed based on facial expressions.
- Real-time Prediction – Receives images via API and returns stress predictions instantly.
- Integration Ready – Designed to work seamlessly with the Face Detection and Frontend modules.
- Python
- TensorFlow / Keras
- OpenCV
- Flask
- NumPy
- Base64 Encoding
- Receives an image (base64-encoded) from the frontend.
- Preprocesses the face and feeds it into the trained CNN model.
- Predicts the emotion (angry, happy, neutral, sad, etc.).
- Maps emotions to stress states (e.g., "angry," "sad," "fear" → stressed).
- Returns the predicted label and stress state via API response.
/stress-detection
│── stressdetector.json # Model architecture
│── stressdetectorV1.h5 # Pre-trained model weights
│── app.py # Flask API for stress prediction
│── requirements.txt # Dependencies
│── README.md # Documentation
git clone https://github.com/yourusername/stress-detection-module.git
cd stress-detection-module
python -m venv venv
source venv/bin/activate # On Mac/Linux
venv\Scripts\activate # On Windows
pip install -r requirements.txt
python app.py
- URL:
/predict
- Method:
POST
- Request Body:
{ "image": "base64_encoded_image_string" }
- Response:
[ { "label": "sad", "state": "stressed", "box": [x, y, width, height] } ]
- Improve model accuracy with larger datasets.
- Enhance multi-face detection capabilities.
- Integrate with student support services for automated interventions.
📌 Related Modules:
- Frontend Module → GitHub Repo
- Face Detection Module → GitHub Repo
🔗 Project Maintainer: Nimtharu Jayasekara