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.