Skip to content

Mayurpatil729/Gender-Detection-Using-Deep-Learning

Repository files navigation

πŸ‘©β€πŸ¦°πŸ‘¨ Gender Detection using Deep Learning

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 πŸ§ πŸ“Έ.

πŸš€ Project Structure

πŸ“ 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

βš™οΈ Setup Instructions

βœ… How to Set Up a Virtual Environment

πŸ”Ή Step 1: Create a Virtual Environment

python -m venv venv

πŸ”Ή Step 2: Activate the Virtual Environment

  • Windows:
venv\Scripts\activate
  • Mac/Linux:
source venv/bin/activate

You’ll know it's activated when you see (venv) in your terminal prompt βœ…


βœ… Step 3: Install All Required Libraries

You can install the needed libraries manually:

pip install opencv-python numpy scikit-learn matplotlib tensorflow==2.10

Or install from the requirements.txt file directly:

pip install -r requirements.txt

πŸ§ͺ How to Run the Project

πŸ”§ 1. Train the Model

python train.py

This script will train the CNN model on the dataset and save it as gender_detection.model.

πŸ“Έ 2. Run Real-Time Gender Detection via Webcam

python detect_gender_webcam.py

This will launch your webcam and start detecting gender in real-time!


πŸ“Œ Notes

  • 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.

🀝 Contribution

If you wish to contribute, feel free to fork this repository and raise a pull request. All contributions are welcome!

πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for more details.


About

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 πŸ§ πŸ“Έ.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages