A deep learning project for predicting facial expressions from images using neural networks. This repository contains code for data preparation, augmentation, model training, and evaluation.
Expression-Predictor/
├── Expression-Predictor.ipynb # Main Jupyter notebook for model development
├── generate_splits_with_datagen.py # Script to split and augment dataset
├── img-data/ # Directory containing training, validation, and testing images
│ ├── training/
│ ├── validation/
│ └── testing/
├── .gitignore
├── readme.md
└── .ipynb_checkpoints/
- Data loading and preprocessing
- Dataset splitting (train/val/test)
- Data augmentation using Keras ImageDataGenerator
- Model training and evaluation
- Easily extensible for new classes or datasets
- Clone the repository:
git clone https://github.com/rbpata/Expression-Predictor cd Expression-Predictor - Install dependencies:
(Add any other dependencies used in your notebook)
pip install tensorflow numpy matplotlib scikit-learn
- Place your images in the
img-data/training/directory, organized by class (e.g.,happy/,sad/). - Use the provided script to split and augment your dataset:
This will create a
python generate_splits_with_datagen.py
generated/directory with new train/val/test splits.
The core model is a Convolutional Neural Network (CNN) built with TensorFlow/Keras:
model = tf.keras.models.Sequential([
#1
tf.keras.layers.Conv2D(16,(3,3),activation = 'relu',input_shape = (200,200,3)),
tf.keras.layers.MaxPool2D(2,2),
#2
tf.keras.layers.Conv2D(16,(3,3),activation = 'relu'),
tf.keras.layers.MaxPool2D(2,2),
#3
tf.keras.layers.Conv2D(16,(3,3),activation = 'relu'),
tf.keras.layers.MaxPool2D(2,2),
#4
tf.keras.layers.Flatten(),
#
tf.keras.layers.Dense(1,activation="sigmoid")
])- Open
Expression-Predictor.ipynbin Jupyter Notebook or JupyterLab. - Follow the notebook cells to:
- Load and preprocess data
- Build and train your model
- Evaluate performance
- Modify
generate_splits_with_datagen.pyto change split ratios or augmentation settings. - Add new classes by creating new folders in
img-data/training/.