CIFAR-10 Image Classification with CNN Ensemble š¼ļøš¤
This project implements an advanced image classification system using Convolutional Neural Networks (CNNs) on the CIFAR-10 dataset. By combining three distinct CNN architectures through ensemble methods, we achieve robust and accurate image classification results. šÆ
Overview š
The project consists of:
- š§ Three CNN models with different architectures
- š Advanced data augmentation techniques
- š¤ Ensemble methods (Simple Averaging and Majority Voting)
- š A Streamlit web interface for real-time predictions
Project Components š¦
āāā CNN_model_1.h5 # Basic CNN architecture
āāā CNN_model_2.h5 # Enhanced CNN with batch normalization
āāā CNN_model_3.h5 # ResNet-inspired architecture
āāā ensemble_classifier.py # Streamlit interface
Model Architectures šļø
1. CNN Model 1 (Base Model) š
- Foundational CNN architecture:
- 3 convolutional layers with increasing filters
- MaxPooling after each conv layer
- Gradually increasing Dropout (0.25 ā 0.5) for regularization
- Dense layers: 512 ā 256 ā 10 (output)
2. CNN Model 2 (Enhanced) š
- Sophisticated architecture:
- 4 convolutional blocks
- Additional filters: 256 in the last convolution blocks
- Additional neurons for a more complicated fully-connected layer : 1024 ā 512 ā 10 (output)
3. CNN Model 3 (ResNet-Inspired) ā
- State-of-the-art features:
- Residual connections (skip connections)
- Identity mappings
- Deep supervision
- Bottleneck layers
Training Pipeline š ļø
Data Preparation š„
- Dataset: CIFAR-10 (60,000 32x32 color images)
- 40,000 training images
- 10,000 validation images
- 10,000 testing images
- Classes: 10 (airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck)
- Preprocessing:
- Normalization: [0,1] range
Data Augmentation š
augmentation = ImageDataGenerator(
rotation_range=15,
width_shift_range=0.1,
height_shift_range=0.1,
horizontal_flip=True,
zoom_range=0.1,
shear_range=0.1
)
Training Configuration āļø
- Batch size: 32
- Epochs: 100 (with early stopping)
- Optimizer: Adam (lr=0.001)
- Loss: Categorical Crossentropy
- Metrics: Accuracy, Top-5 Accuracy
Running the Interface š„ļø
Local Deployment š
streamlit run ensemble_classifier.py
Google Colab Deployment āļø
!pip install streamlit
!streamlit run ensemble_classifier.py & npx localtunnel --port 8501
Usage Guide š±
- š„ Download the pre-trained models
- š Launch Streamlit interface
- š¼ļø Upload a 32x32 RGB image
- š Click "Make Prediction"
- š View detailed classification results
Model Performance Comparison:
āāāāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāā
ā Model ā Accuracy ā
āāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāā¤
ā CNN Model 1 (Base) ā 84% ā
ā CNN Model 2 (Enhanced) ā 86% ā
ā CNN Model 3 (ResNet) ā 89% ā
ā Ensemble (Majority) ā 87% ā
āāāāāāāāāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāā
Future Improvements š®
- š§ Implement more advanced ensemble techniques
- šÆ Add model interpretability features
- š Optimize for mobile deployment
- š Add confusion matrix visualization
- š Real-time data augmentation
Requirements š
- Python 3.7+
- TensorFlow 2.17.1
- Streamlit
- NumPy
- OpenCV
- Pillow
License š
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ā¤ļø for the Computer Vision community
