Skip to content

Tejarsha-Arigila/Age-Gender-Emotion-Analyzer

Repository files navigation

License: MIT

🚀 AGenEmozer (Age, Gender, and Emotion Analyzer)

Python OpenCV TensorFlow Keras NumPy Pandas

AGenEmozer is a software tool that uses artificial intelligence to make educated guesses about a person's age, gender, and emotional state from a photo.

Table of Contents

Output

Description

The project includes four main Python scripts:

  1. age_training.py: This script is for training a Convolutional Neural Network (CNN) model to recognize different age groups from images. The trained model is saved as 'age_model.h5'.

  2. gender_training.py: This script is for training a CNN model to recognize gender from images. The trained model is saved as 'gender_model.h5'.

  3. emotion_training.py: This script is for training a CNN model to recognize three classes of emotions from images: positive, negative, and neutral. The trained model is saved as 'emotion_model.h5'.

  4. AGenEmozer.py: This script uses three pre-trained models to analyze faces in images or from a webcam feed. It predicts the age, gender, and emotion for each detected face.

🛠 Installation

  1. Clone this repository.
git clone https://github.com/Tejarsha-Arigila/Age-Gender-Emotion-Analyzer.git
  1. Install required Python packages.
pip install -r requirements.txt

🎮 Usage

Datasets

Download the datasets and place them under ./data/ folder before training.

  1. Age : Merged & Augmented UTK Faces & Facial Age Dataset
  2. Gender : UTKFace
  3. Emotion : CK + 48

🎓 Train the Models

Each training script accepts a configuration file as an argument. These configuration files are expected to be in YAML format and specify details like the directory of the training data, the model path, the number of epochs for training, and other parameters.

  1. Run the age_training.py script.
python age_training.py --config ./configs/age_config.yaml
  1. Run the gender_training.py script.
python gender_training.py --config ./configs/gender_config.yaml
  1. Run the emotion_training.py script.
python emotion_training.py --config ./configs/emotion_config.yaml

🌟 Use the Age, Gender, and Emotion Analyzer

Run the AGenEmozer.py script.

  • To analyze an image, provide the image path as an argument:
python AGenEmozer.py --image <image_path.jpg>
  • To analyze the webcam feed, run the script without the image argument:
python AGenEmozer.py

📢 Note

Please ensure that the models 'age_model.h5', 'gender_model.h5', and 'emotion_model.h5' are present in ./model/ directory of the project. You can train these models using the provided scripts.

🤝 Contribution

Contributions are welcome! Please create an issue for discussion before submitting a pull request.

📜 License

This project is licensed under the MIT License. Please see the LICENSE file for details.