Skip to content

Latest commit

 

History

History
105 lines (64 loc) · 2.3 KB

File metadata and controls

105 lines (64 loc) · 2.3 KB

👩‍🦰👨 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.