This project detects gender (male/female) from webcam video frames using deep learning and OpenCV. It uses a pre-trained CNN model on facial image datasets to classify gender in real time 🧠📸.
📁 gender_dataset_face/ → Dataset folder
📁 venv/ → Virtual environment (not uploaded)
📄 detect_gender_webcam.py → Main script to detect gender via webcam
📄 gender_detection.model → Trained model file
🖼️ plot.png → Training accuracy/loss plots
📘 Readme.md → Project documentation
📄 requirements.txt → All required libraries
📄 train.py → Script to train the model
python -m venv venv- Windows:
venv\Scripts\activate- Mac/Linux:
source venv/bin/activateYou’ll know it's activated when you see (venv) in your terminal prompt ✅
You can install the needed libraries manually:
pip install opencv-python numpy scikit-learn matplotlib tensorflow==2.10Or install from the requirements.txt file directly:
pip install -r requirements.txtpython train.pyThis script will train the CNN model on the dataset and save it as gender_detection.model.
python detect_gender_webcam.pyThis will launch your webcam and start detecting gender in real-time!
- Make sure your webcam is working properly.
- For best performance, ensure you have good lighting on your face.
- The model might require further fine-tuning based on your dataset size and quality.
If you wish to contribute, feel free to fork this repository and raise a pull request. All contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for more details.