Skip to content

rbpata/Expression-Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Expression Predictor

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.

Project Structure

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/

Features

  • 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

Setup

  1. Clone the repository:
    git clone https://github.com/rbpata/Expression-Predictor
    cd Expression-Predictor
  2. Install dependencies:
    pip install tensorflow numpy matplotlib scikit-learn
    (Add any other dependencies used in your notebook)

Data Preparation

  • 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:
    python generate_splits_with_datagen.py
    This will create a generated/ directory with new train/val/test splits.

Model Architecture

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")
])

Usage

  • Open Expression-Predictor.ipynb in Jupyter Notebook or JupyterLab.
  • Follow the notebook cells to:
    • Load and preprocess data
    • Build and train your model
    • Evaluate performance

Customization

  • Modify generate_splits_with_datagen.py to change split ratios or augmentation settings.
  • Add new classes by creating new folders in img-data/training/.

About

Predict the expression from photo whether Happy or SAD.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors