This Python script uses OpenCV and a pre-trained Keras deep learning model to perform real-time gender detection through a webcam.
This project focuses on building an AI-powered gender detection system using facial images. It leverages a Convolutional Neural Network (CNN) to classify gender as either Male or Female based on facial features. The system is trained on the UTKFace dataset and includes both model training and real-time prediction through webcam using OpenCV.
The project has two main components:
Model Training Pipeline
Loads and preprocesses images.
Trains a CNN using TensorFlow/Keras.
Evaluates the model with accuracy metrics and plots.
Real-Time Gender Prediction
Uses Haar cascade to detect faces from a live webcam stream.
Loads the trained model.
Predicts and displays gender labels on detected faces in real time.
This can be used in smart surveillance, demographic analysis, and interactive systems requiring basic human profiling.
The UTKFace Dataset is a large-scale facial dataset with over 20,000 images.
Follow the steps below to train the model and run real-time gender detection:
1οΈβ£ Clone the Repository
2οΈβ£ Install Dependencies
3οΈβ£ Download the Dataset
4οΈβ£ Train the Model
5οΈβ£ Run Real-Time Gender Detection