A real-time emotion detection system that recommends movies and music based on a person's detected emotion.
Python
OpenCV: For capturing and processing images.
Deep Learning Framework: Tensorflow/Keras.
Machine Learning Libraries: Pandas, Numpy.
Importing Model: Joblib.
Emotion Dataset/Images: Use publicly available datasets like in kaggle.
Classes: Define emotions (e.g., Happy, Sad, Angry, Neutral, Disguist, Fear, Surprise etc.).
Movies and Music Dataset: Use publicly available datasets like in kaggle.
Create a function which give the music based on the mood of the person.
# def music_recom(Emotion): filter=df[df['Emotion']==Emotion] if not filter.empty: top_music=filter.iloc[:5]['Name'] print("\n".join(top_music)) else: print(f"No music found for the emotion:{Emotion}")
Create a function which give the movie based on the mood of the person.
# emotion_to_genre = { 'Sad': 'Drama', 'Disguist': 'Crime', 'Anger': 'Action', 'Happy': 'Comedy', 'Neutral': 'Family', 'Surprise': 'Fantasy', 'Fear': 'Horror', } def recommend(Emotion): genre=emotion_to_genre.get(Emotion) if genre: filter=df[df['Genre'].str.contains(genre,case=False,na=False)] if not filter.empty: top_movies=filter.iloc[:5]['Movie_Name'] print("\n".join(top_movies)) else: print(f"No movie found for the genre: {genre}") else: print(f"No genre found for the emotion:{Emotion}")
Detect the emotion of the person and give the music and movie recommendation to person. For detecting the emotion i used the cnn model and keras libraries.
# model=Sequential() model.add(Conv2D(128,kernel_size=(3,3),activation='relu',input_shape=(64,64,1))) model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dropout(0.4)) model.add(Conv2D(256,kernel_size=(3,3),activation='relu')) model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dropout(0.4)) model.add(Conv2D(512,kernel_size=(3,3),activation='relu')) model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dropout(0.4)) model.add(Conv2D(512,kernel_size=(3,3),activation='relu')) model.add(MaxPooling2D(pool_size=(2,2))) model.add(Dropout(0.4)) model.add(Flatten()) model.add(Dense(512,activation='relu')) model.add(Dropout(0.4)) model.add(Dense(256,activation='relu')) model.add(Dropout(0.3)) model.add(Dense(7,activation='softmax'))