A robust deep learning pipeline for gender classification and face verification under challenging, real-world conditions, inspired by Vedic principles of fairness and accuracy.
All the submission files are under PROUDUCTION and the two Releases with tags
publish101andpublish102.
CNN_vedic/
βββ PRODUCTION/
β βββ Task_A/ # Gender classification (VGG19-based)
β β βββ training/ # Training scripts, logs, plots
β β βββ inference/ # Inference & Grad-CAM scripts
β β βββ test/ # Test images for inference
β βββ Task_B/ # Face verification (Triplet Network)
β β βββ training/ # Triplet model training, embedding extraction
β β βββ inference/ # Face matching demo
β β βββ test/ # Test/reference images for verification
βββ [DEPRECATED MODELS]/ # Old/experimental models & scripts
βββ Data/ # (Git-ignored) Training/validation/test data
βββ TASK.md # Challenge description & dataset structure
βββ README.md # (You are here)
βββ app/ # Contains the server.py for the flask server inference
βββ index.html # frontend entry to check inference using a GUI
This project addresses two core computer vision tasks:
- Goal: Predict gender (male/female) from face images, even in poor lighting or weather.
- Approach: Fine-tuned VGG19 with focal loss, heavy augmentation, and class balancing.
- Key Features:
- Handles class imbalance (more male images than female).
- Auto-threshold tuning for optimal F1 score.
- Grad-CAM for model explainability.
- Visual Explainability: Uses Grad-CAM to highlight which regions of the face the model focuses on to determine gender, displaying a heatmap overlay. See PRODUCTION/Task_A/inference/inference_vgg19_updated.py for implementation details.
- Relevant Files:
PRODUCTION/Task_A/training/train_vgg19_updated.pyβ Full training pipeline.PRODUCTION/Task_A/inference/inference_vgg19_updated.pyβ Inference & Grad-CAM.
Put the model in this folder from the link:
vgg19_final_epochPRODUCTION/models/vgg19_final_epoch.h5β Final model weights.PRODUCTION/Task_A/training/vgg19_training_logs.txtβ Training/evaluation logs.
-
Goal: Match distorted face images to correct identity using embeddings (not classification).
-
Approach: Triplet Network with ResNet50 backbone, trained to minimize intra-class and maximize inter-class distances.
-
Key Features:
- Embedding extraction for similarity-based matching.
- Automatic threshold tuning for best accuracy.
-
Relevant Files:
PRODUCTION/Task_B/training/tripletNetwork_updated.pyβ Triplet training pipeline.PRODUCTION/Task_B/training/embedding_model_extract.pyβ Extracts embedding submodel.PRODUCTION/Task_B/inference/verify_face.pyβ Face verification demo.
Put the model in this folder from the link
Note: You only need the embedding_sequel.h5 model from here: embedding_sequel.h5
PRODUCTION/models/tripletNetwork.h5β Full triplet model.PRODUCTION/models/embedding_sequel.h5β Embedding-only model.PRODUCTION/Task_B/training/tripletTrainingLogs.txtβ Training/evaluation logs.
- Task_A/: All scripts, logs, and models for gender classification.
training/: Training code, logs, and plots.inference/: Inference script with Grad-CAM visualization.
- Task_B/: All scripts, logs, and models for face verification.
training/: Triplet network training, embedding extraction.inference/: Face verification demo using embeddings.
- models/: Final production models (
.h5), ready for inference.
- Contains experimental, ablation, and legacy models/scripts (Keras, PyTorch, EfficientNet, etc.).
- Not for production use; see
README.mdinside for details.
- Not included in repo (see
.gitignore). - Structure for Task A and Task B as described in
Task.md.
- Full challenge description, dataset structure, and objectives for both tasks.
- Train:
RunPRODUCTION/Task_A/training/train_vgg19_updated.py(requires data inData/Task_A/). - Inference:
Place test image inPRODUCTION/Task_A/test/, runPRODUCTION/Task_B/inference/inference_vgg19_updated.py. - Model:
Downloadvgg19_final_epoch.h5from releases.
- Train:
RunPRODUCTION/Task_B/training/tripletNetwork_updated.py(requires data inData/Task_B/). - Extract Embedding Model:
Runembedding_model_extract.pyafter training. - Inference:
Place reference/test images, runPRODUCTION/Task_B/inference/verify_face.py. - Model:
Downloadembedding_sequel.h5from releases.
- Class Imbalance Handling:
Automatic class weights and focal loss for fair gender classification. - Data Augmentation:
Robust to real-world distortions (rotation, brightness, etc.). - Auto Threshold Tuning:
Finds best probability/distance threshold for optimal F1/accuracy. - Explainability:
Grad-CAM visualizations for gender model, showing which parts of the face are being scanned to determine gender using a heatmap. - Production-Ready:
All production models and scripts are inPRODUCTION/.
- Gender Classification:
- Accuracy: ~97% (see vgg19_training_logs.txt
- Balanced precision/recall for both genders.
- Face Verification:
- Accuracy: ~96% (see tripletTrainingLogs.txt)
- High precision/recall for identity matching.
| Component | Version |
|---|---|
| Python | 3.10.0 |
| TensorFlow | 2.9.0 |
| CUDA Toolkit | 11.8 |
| cuDNN | 8.6.0 |
| GPU | NVIDIA RTX (6GB or higher) recommended |
Install with:
pip install -r requirements.txtInstall with:
pip install -r requirements_GPU.txtOR
conda env create -f facecom_env.yml
Check Runtime File to get detailed steps on 100% reproducable inference smoothly
Ensure CUDA 11.8 and cuDNN 8.6.0 are installed and properly configured for GPU support (only if you are accessing the training scripts)
- See
Task.mdfor dataset structure and challenge details. - Model weights and releases:
GitHub Releases
Developed by Circuit-Overtime and contributors.
For academic/educational use only.


