Enzyme is an open-source machine learning model designed for flexibility, transparency, and experimentation. Whether you're training on custom datasets, fine-tuning existing logic, or exploring new frontiers in AI, ENZYME provides a fully modifiable Python-based framework.
Ideal for researchers, developers, and curious minds - with ENZYME, you don't just use the model, you make it your own.
A machine learning project to classify gender (Male/Female) from face images using deep learning and computer vision. The system includes data collection, preprocessing using YOLOv8n-face, CNN training, prediction, and API deployment.
/
βββ collect_dataset.py # Collect raw face dataset via webcam
βββ clean_dataset.py # Clean dataset using YOLOv8n-face (grayscale, cropped faces)
βββ trainer.py # Train CNN model with cleaned dataset
βββ predict_img.py # Predict gender from a single image
βββ predict_video.py # Predict gender from video
βββ predict_webcam.py # Real-time gender prediction via webcam
βββ server.py # Flask API for prediction
β
βββ dataset/ # Raw images
β βββ male/
β βββ female/
β
βββ cleaned/ # Preprocessed (cropped + grayscale)
β βββ male/
β βββ female/
Use webcam to collect images categorized into male or female:
python collect_dataset.pyImages are saved under the dataset/ directory.
Detect and crop faces using Ultralytics YOLOv8n-face, convert to grayscale, and save:
python clean_dataset.py- Uses YOLOv8n-face (
yolov8n-face.pt) - Crops faces from images and saves grayscale versions
- Processes multiple categories and images concurrently with multithreading
- Cleaned images are saved in
cleaned/
Train a CNN model to classify gender based on the cleaned face dataset:
python trainer.pyModel will be saved as enzyme_model.h5.
Predict gender using the trained model:
- From image:
python predict_img.py
- From video:
python predict_video.py
- From webcam:
python predict_webcam.py
Start the Flask server for remote prediction:
python server.pyEndpoint:
POST /predictβ Accepts image uploads, returns predicted gender.
Install all dependencies:
pip install -r requirements.txtLibraries used:
opencv-pythonultralyticstqdmflasktensorfloworkeras
- YOLOv8n-face model file (
yolov8n-face.pt) must be available in the same directory or specify the correct path inclean_dataset.py. - The system uses multithreading to speed up image preprocessing.
- Supports
.jpg,.jpeg,.pngimages.
Wiji Fiko Teren
π wijifikoteren.streampeg.com
π§ Email: tobellord@gmail.com / wijifikoteren@streampeg.com
πΊ YouTube: @wijifikoteren
β Donate: PayPal - paypal.me/wijifikoteren
MIT License β use freely for learning and development.