This project implements a Convolutional Neural Network (CNN) for gender classification based on facial images. The model is trained on a dataset containing images of individuals wearing masks. The goal is to predict whether the person is Male or Female using deep learning techniques.
├── Dataset/ # Folder containing images
│ ├── Female/ # Images of female individuals
│ ├── Male/ # Images of male individuals
├── CNN_Model.ipynb # Jupyter Notebook containing training and evaluation
├── plot_accuracy_loss.png # plot of accuracy and loss
├── masked_sample # sample of images used for training
├── requirements.txt # Dependencies required to run the project
└── README.md # Project documentation
git clone https://github.com/MohaYass92/Gender-Detection-on-Masked-Faces-with-CNN
cd Gender-Detection-on-Masked-Faces-with-CNNEnsure you have Python 3.x installed, then run:
pip install -r requirements.txtYou can run the Jupyter Notebook in Google Colab or locally:
jupyter notebookThen open CNN_Model.ipynb and execute the cell.
The notebook contain only one cell and it includes:
- Load and preprocess the dataset
- Define and train a CNN model using TensorFlow/Keras
- Evaluate the model on the dataset
- Save the trained model for later use
The dataset contains images of masked individuals, divided into two folders:
Female/Male/
Ensure that your dataset is correctly placed before running the notebook.
The trained model is saved in .keras format. You can load and use it later:
from tensorflow.keras.models import load_model
model = load_model('CNN_Model.keras')The training accuracy and loss curves are shown below:
This project is open-source. Feel free to modify and improve it!

