How maheshsathe07/emotion-based-music-recommendation-system works
Main Components
• User Interface (UI): Represented by the Streamlit-based frontend that’s launched via app.py. This serves as the primary point of interaction where users can view recommendations and possibly trigger the emotion detection.
• Data Management & Preprocessing:
• Data Files: CSV datasets (e.g., filtered_track_df.csv) and the data folder hold the merged Spotify datasets.
• Preprocessing: The preprocess_data.ipynb notebook hints at exploratory data preparation and dataset merging.
• Music Recommendation Engine:
• Algorithm: Implemented using the K-Nearest Neighbors algorithm (likely integrated into app.py or as part of utility functions).
• Facial Emotion Detection Module:
• Core Script: The emotion.py module, which is responsible for processing facial inputs, likely serving as the interface to trigger emotion detection.
• Model File: The facialemotionmodel.h5 file contains the ResNet-based pre-trained model used for emotion classification.
• Infrastructure & Deployment:
• Additional files such as Procfile, setup.sh, and requirements.txt are used for deployment and dependency management.
• License and README provide documentation and legal guidelines.
Relationships and Data Flows
• Divide the application logic into two paths:
• Music Recommendation Path: This path uses the user’s interaction to invoke the recommendation engine that processes the filtered track data (filtered_track_df.csv) and returns music recommendations.
• Emotion Detection Path: In parallel, if facial emotion detection is triggered, the UI sends the input to the emotion.py module, which loads the facialemotionmodel.h5 to classify the user’s emotion using the ResNet architecture.
• Merge Results (if applicable): Optionally, the results of the emotion analysis may influence the recommendation algorithm, so clearly show a connection or data exchange between the emotion detection module and the recommendation engine.
• Data Preprocessing Block: Illustrate how the raw Spotify datasets are processed (as hinted by preprocess_data.ipynb) to produce the filtered track dataset. This process might be depicted as a separate batch or ETL (Extract, Transform, Load) component that feeds into the recommendation engine.
Architectural Patterns and Technologies
• A modular design: Each of the major components (UI, data processing, recommendation logic, and emotion detection) should be represented as separate blocks/components.
• The flow from the UI to the backend logic.
• Data interactions between the preprocessing pipeline and both the recommendation engine and data sources.
• The dependency between the emotion detection module and its pre-trained ResNet model.
• Key technologies:
• Python as the development language.
• Pandas and Scikit-learn for data processing and machine learning.
• Streamlit for the web UI.
• ResNet (via the h5 model file) for emotion detection.
• “Music Recommendation Engine” where the KNN algorithm is applied.
• “Emotion Detection Module” where the ResNet model is loaded.
• “Raw Spotify Datasets” and the “Preprocess Data Notebook” feeding into a “Filtered Track Dataset (CSV)”.
• Deployment and configuration components:
• Presence of files like Procfile, setup.sh, and requirements.txt—while these may not have an active role in the data flow, they can be mentioned as part of the infrastructure/configuration layer.
Final Assembly
• Data entry from the UI.
• Processing logic in recommendation and emotion detection.
• The ultimate output back to the UI (i.e., recommended tracks based on both dataset matching and detected emotion).