Depression Detection in Social Media:A Comprehensive Review of Machine Learning and Deep Learning Techniques
Depression is one of the most common mental health challenges in today’s digital era, and early detection is crucial for effective intervention. With the rise of social media, users often express emotions and moods through text and images that can reflect their mental well-being. This project, Depression Detection on Social Media, aims to leverage artificial intelligence to automatically identify signs of depression from users’ text posts and facial expressions. The system integrates deep learning and natural language processing techniques to analyze multimodal data and predict depression risk in real time.
The Depression Detection on Social Media system is a real-time AI-powered web application built using Flask, combining both facial emotion recognition and text sentiment analysis to detect potential depression levels in users. It utilizes Convolutional Neural Networks (CNN) for analyzing facial expressions from uploaded images and NLP models (using NLTK and spaCy) for interpreting the emotional tone of text-based social media posts. A rule-based fusion algorithm consolidates both results to produce a final depression risk score. The web app provides role-based access for users and administrators—users can upload data and view their depression analysis results, while admins can monitor user activity, risk levels, and historical trends. All data is securely stored in a MySQL database, ensuring privacy and reliability. The system also includes therapy suggestions and consultation recommendations, offering a supportive interface that bridges AI technology and mental health care.
. Programming Language: Python
. Web Framework: Flask
. Deep Learning Library: TensorFlow / Keras
. Natural Language Processing: NLTK, spaCy . Computer Vision: OpenCV
. Database: MySQL (via XAMPP)
. Frontend: HTML, CSS, JavaScript
. Model Files: CNN model (depression_cnn_model.h5) and NLP model (nlp_sentiment_model.pkl)
python -m venv venv venv\Scripts\activate # (Windows)
pip install -r requirements.txt
Open XAMPP or MySQL Workbench Create a new database named depression_db Import the provided depression_db.sql file
python app.py
Database Configuration: Update your database credentials in app.py if needed:
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = ''
app.config['MYSQL_DB'] = 'depression_db'
Place your pre-trained models (depression_cnn_model.h5 and nlp_sentiment_model.pkl) in the project’s root directory.
Username: admin
Password: password