Emotion-Based Music Recommender is a real-time facial emotion recognition application that detects a user's emotional state through a webcam and recommends music accordingly. The system uses OpenCV for face detection, an LBPH (Local Binary Pattern Histogram) classifier for emotion recognition, and Streamlit for an interactive web interface.
The application analyzes facial expressions and recommends songs that match the detected emotion, creating a personalized music listening experience.
-
Real-time webcam-based face detection
-
Facial emotion recognition using LBPH
-
Emotion-specific music recommendations
-
Interactive Streamlit user interface
-
Support for multiple emotions:
- Angry
- Disgust
- Fear
- Happy
- Neutral
- Sad
- Surprise
Webcam Input
│
▼
Face Detection (Haar Cascade)
│
▼
Emotion Recognition (LBPH)
│
▼
Emotion Prediction
│
▼
Music Recommendation
│
▼
Streamlit Interface
- Python
- OpenCV
- Streamlit
- NumPy
- Pandas
train/
├── angry/
├── disgust/
├── fear/
├── happy/
├── neutral/
├── sad/
└── surprise/
Each folder contains facial images corresponding to a specific emotion used for training the LBPH classifier.
Clone the repository:
git clone https://github.com/Swaroop-Haridas/Emotion_Based_Music_Recommender.git
cd Emotion_Based_Music_RecommenderInstall dependencies:
pip install -r requirements.txtTrain the emotion recognition model:
python train_model.pyThis generates:
model.h5
labels.npy
Start the Streamlit application:
streamlit run app.py