- Ronak 40221814
- Vijendra 40221273
- Aayush 40272388
The aim of this project is to develop an efficient and accurate system for classifying facial expressions from given photos using Convolutional Neural Networks (CNN).
- Make sure the root directory is set as
APPLIEDAIto make sure all the relative paths are working corrently.
-
data_visualisation.py:
plot_histogram: Visualizes image distribution across expression categories.display_random_images: Shows random images grid from four categories.plot_histograms_from_paths: Plots histograms of pixel intensities.
-
convert_greyscale_and_resize.py:
- Automates conversion of images to grayscale and resizes them to 48x48 pixels.
-
image_sharpening.py:
preprocess_images_in_directories: Enhances images with grayscale conversion, blurring, and unsharp masking.
-
image_labeling.py:
- Labels images in the format
<class_label_name>_XXXX.jpg.
- Labels images in the format
-
filtering_locating_faces.py:
- Detects and extracts faces from images.
-
experiment.py:
- Contains experimental code used during project development.
-
train.py (Part-2 folder):
- Trains the model using preprocessed and labeled images.
-
application.py (Part-2 folder):
- Loads the trained model for facial expression prediction.
Ensure the Data folder is set up correctly and all paths are relative to the Applied AI main directory.
- Run
filtering_locating_faces.py. - Run
convert_greyscale_and_resize.py. - Run
image_sharpening.py. - Run
image_labeling.py.
- A folder named
Datawith four subfolders for facial expression classes.
- Run
data_prep.py. - The dataset will be in
dataset_inshapeunder thePart_2directory.
- Navigate to
Part-2. - Run
train.pyand choose option2forModel_variant2. - The trained model is saved in
Part_2/saved_model.
- Run
application.py. - Provide an image path for facial expression identification.
- Use external images for testing.
This part of the project focuses on identifying any biases in the trained model and implementing strategies to mitigate these biases.
- Dataset related folders such as
DataKF,dataset_inshape,updated_datasetinshape,UpdatedDataKFwith four subfolders for facial expression classes andsaved_models.
generate_confusion_matrix_on_test_set.pyfile is used to run an existing model over test dataset to generate confusion matrix and check the performance of the modelhelper_function.pyfile is modified to halt the training of the model if the accuracy keeps decreasing and saved the best model with the highest accuracy over all the successful executiontrain.pyfile is modified to use the same split of dataset to train and validate different models to maintain consistency in the results
- Navigate to
Part_3. - Run
train.py. - The trained model will be saved in
saved_modelsnamedbest_model.pth.
- Run
application.py. - Provide an image path for facial expression identification.
- Use external images for testing.
Follow these instructions for successful project execution. For support or contributions, open an issue or submit a pull request.