The objective of this project is to develop a Deep Learning Convolutional Neural Network (CNN) using PyTorch that can analyze images of students in a classroom or online meeting setting and categorize them into distinct states or activities. The 4 classes of facial expressions our articial neural network can predict are Neutral, Engaged, Angry, and Happy.
Data Specialist: Nadim Khalife
Training Specialist: Jungsoo Lee
Evaluation Specialist: Victor-Thyreth Ouy
src/data_cleaning.py : Python script for data cleaning of our dataset
src/visualization.py: Python script to create the data visualization
dataset_information.md: Document detailing the sources and licensing of our dataset (https://www.kaggle.com/datasets/msambare/fer2013)
AI Project Part 1 - Report.pdf: Project Report
Originality Form folder: Signed Expectation of Originality forms from each team member
dataset folder: Folder containing the dataset images
dataset-cleaned folder: Folder created after running data_cleaning.py that contains the cleaned dataset images
Note: The following steps are assuming you are running our code with the same folder hierarchy as shown in our Github repository.
- Make sure you are in the root folder when typing commands in the terminal.
- Enter
py -m venv .venvfor Windows orpython3 -m venv .venvfor Unix/macOS. - Enter
.venv\Scripts\activatefor Windows orsource .venv/bin/activatefor unix/macOS to activate the environment. - Enter
pip install -r requirements.txtto install packages.
- From the root folder, enter
cd src. - Enter
python data_cleaning.pyto execute the script. - This script will create or replace a folder in the root dir called 'dataset-cleaned'
- From the root folder, enter
cd src. - Enter
python visualization.pyto execute the script.
- From the root folder, enter
cd src. - Enter
python split_dataset.pyto split dataset for which the models will train.- a. Enter the relative path of the dataset you would like to split and train off of.
- Executing scripts for training models:
- a. Main Model: enter
python trainAI_main.py - b. Variant 1: enter
python variant1.py - c. Variant 2: enter
python variant2.py
- a. Main Model: enter
- You first need to train the models (in steps above)
- From the root folder, enter
cd src. - Enter
python evaluation_models.py
- From the root folder, enter
cd src. - Enter
python evaluation.pyto load the model. - Type "Dataset" if you wanna test the whole dataset or "single" if you wanna predict a single image.
- If you typed "single", type the category of the image (angry, engaged, happy, or neutral).
- If you typed "single", then type the full filepath of the image you wish to predict
c. Variant 2: enter
python variant2.py
- From the root folder, enter
cd src. - You first need to split the training data.
- a. Enter
python split_dataset.pyto split dataset. - b. Then you need to enter the relative path of the dataset (either one of the following):
- Level 1: enter
../dataset-bias_level1/ - Level 2: enter
../dataset-bias_level2/ - Level 3: enter
../dataset-bias_level3/
- Level 1: enter
- a. Enter
- Create and train the bias models (either one of the following):
- a. Level 1: enter
python trainAI_bias1.py - b. Level 2: enter
python trainAI_bias2.py - c. Level 3: enter
python trainAI_bias3.py
- a. Level 1: enter
- Now, enter
python evaluation_bias.pyto evaluate the model based on the biases.- a. Enter the model name you would like to evaluate
- Level 1: enter
model_bias1.pth - Level 2: enter
model_bias2.pth - Level 3: enter
model_bias3.pth
- Level 1: enter
- a. Enter the model name you would like to evaluate
- From the root folder, enter
cd src. - You first need to obtain the folds for the k-fold cross-validation.
- a. Enter
python kfolding.pyto obtain and save the folds.
- a. Enter
- Then, train with k-fold cross-validation by entering
python kfold_train.py.
- From the root folder, enter
cd src. - Enter
python evaluation_kfold.pyto obtain the performance metrics and confusion matrix.