Detect age and gender from facial images like a pro! ๐
Advanced deep learning models for facial attribute analysis with style
A powerful deep learning project that analyzes facial images to predict age, gender, and ethnicity. Think of it as your personal facial analysis AI! ๐ง
- ๐ฏ Multi-task learning (Age, Gender, Ethnicity)
- ๐ง Deep CNN architecture with TensorFlow/Keras
- ๐ Comprehensive data analysis and visualization
- ๐ Data augmentation for better model performance
- ๐ Training metrics and model evaluation
- ๐พ Model serialization for deployment
- ๐จ Beautiful visualizations with Plotly
- โก Optimized training with callbacks
# 1. Clone it
git clone <your-repo-url>
cd Gender-and-Age-Detection
# 2. Install dependencies
pip install tensorflow pandas numpy matplotlib seaborn plotly scikit-learn
# 3. Run the notebook!
jupyter notebook "Age Detection.ipynb"
That's it! ๐
jupyter notebook "Age Detection.ipynb"
Perfect for interactive development and analysis
# Upload the notebook to Google Colab
# Enable GPU runtime for faster training
For cloud-based training with GPU acceleration
# Run specific cells or convert to Python script
python -c "exec(open('Age Detection.ipynb').read())"
For automated training pipelines
๐ Dataset Statistics:
- Total samples: 23,705 faces
- Age range: 1-116 years
- Gender distribution: Male/Female balanced
- Ethnicity classes: 5 categories
๐ง Model Performance:
- Gender accuracy: ~52.6%
- Age accuracy: Varies by age group
- Ethnicity accuracy: ~43.2%
๐ Training Metrics:
- Batch size: 64
- Epochs: 100 (with early stopping)
- Learning rate: 0.001 (adaptive)
Gender-and-Age-Detection/
โโโ ๐ฅ Age Detection.ipynb # Main analysis notebook
โโโ ๐ง age.h5 # Trained age model
โโโ ๐ค gender.h5 # Trained gender model
โโโ ๐ age_gender.csv # Processed dataset
โโโ ๐ README.md # This file
โโโ ๐ LICENSE # MIT License
- Comprehensive dataset exploration
- Age distribution analysis
- Gender and ethnicity balance check
- Missing value detection
- Statistical summaries
- Multi-task CNN architecture
- Convolutional layers with batch normalization
- Dropout layers for regularization
- Dense layers for classification
- Softmax/Sigmoid activations
- Image normalization (0-1 scaling)
- Data augmentation (rotation, zoom, shift)
- Train-test splitting (70-30)
- One-hot encoding for categorical variables
- Early stopping to prevent overfitting
- Learning rate reduction on plateau
- Confusion matrix analysis
- Accuracy metrics for each task
- Model serialization (.h5 format)
- Age distribution histograms
- Gender balance pie charts
- Ethnicity distribution bar plots
- Training curves with Plotly
- Confusion matrices heatmaps
- ๐ฒ Multi-task learning (3 models in 1)
- ๐ฎ Interactive visualizations with Plotly
- ๐ฅ Hidden data insights
- ๐จ Beautiful plotting with seaborn
- ๐ฏ Real-time training progress
- ๐ช Comprehensive model evaluation
Problem: ModuleNotFoundError: No module named 'tensorflow'
Solution: pip install tensorflow pandas numpy matplotlib seaborn plotly scikit-learn
Problem: GPU not detected
Solution: Install GPU version: pip install tensorflow-gpu
Problem: Memory issues during training Solution: Reduce batch size or use data generators
Problem: Slow training Solution: Enable GPU runtime in Colab or use cloud instances
- Multi-task CNN for simultaneous prediction
- Data augmentation pipeline for robustness
- Comprehensive EDA with statistical analysis
- Model evaluation with multiple metrics
- Production-ready model serialization
- Scalable architecture for large datasets
- Input Layer: 48x48x1 grayscale images
- Conv2D Layers: Feature extraction
- MaxPool2D: Dimensionality reduction
- BatchNormalization: Training stability
- Dropout: Regularization
- Dense Layers: Classification heads
- Age: 1-116 years (continuous)
- Gender: Male/Female (binary)
- Ethnicity: 5 categories (multi-class)
- Images: 48x48 grayscale pixels
- Gender Accuracy: ~52.6%
- Age Accuracy: Varies by age group
- Ethnicity Accuracy: ~43.2%
- Training Time: ~30-60 minutes (CPU)
- Model Size: ~10-15 MB per model
- Inference Speed: Real-time capable
- Fork it ๐ด
- Create a branch ๐ฟ
- Make changes โ๏ธ
- Submit PR ๐
Ideas welcome! ๐ก
- Primary Dataset: Age, Gender, and Ethnicity Face Data (CSV)
- Source: Kaggle Dataset by Nipun Arora
- Size: 23,705 facial images
- Format: 48x48 grayscale pixels
- Attributes: Age, Gender, Ethnicity
For educational and research purposes! This project analyzes facial images for age, gender, and ethnicity prediction. Always respect privacy and ensure proper consent when using facial analysis technology! ๐ค
This project is licensed under the MIT License - see the LICENSE file for details.