Emotion Recognition Model

This repository hosts a custom-tuned Emotion Recognition model designed to analyze facial expressions in real-time video streams. The model predicts seven distinct emotions: Angry, Disgust, Fear, Happy, Neutral, Sad, and Surprise, and calculates a positivity level based on the predicted emotions.

Model Details

  • Model Architecture: The model is based on a fine-tuned VGG16 architecture using TensorFlow.
  • Input Size: 224x224 pixels
  • Emotion Labels:
    • Angry
    • Disgust
    • Fear
    • Happy
    • Neutral
    • Sad
    • Surprise

How to Use

  1. Clone the repository and install the dependencies:
pip install -r requirements.txt
  1. Load the model and run predictions on images:
from tensorflow.keras.models import load_model
import cv2
import numpy as np
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.applications.vgg16 import preprocess_input

model = load_model('emotion_model_finetuned224.h5')

# Example usage with an image
image = cv2.imread('example.jpg')
face = cv2.resize(image, (224, 224))
face = img_to_array(face)
face = preprocess_input(face)
face = np.expand_dims(face, axis=0)
predictions = model.predict(face)
print(predictions)

Gradio Interface (Optional)

If you want to deploy the model using Gradio, you can use the app.py file provided:

pip install gradio
python app.py

Visit the Gradio interface at http://localhost:7860 and upload an image to see the predicted emotion.

Dependencies

  • tensorflow
  • opencv-python
  • numpy
  • requests
  • gradio (for optional web interface)

License

This project is licensed under the MIT License. Feel free to use and modify as needed.

Contact

For questions or support, please open an issue on the GitHub repository or contact Ahmad directly at migdady@gmail.com.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support