A deep learning project implementing a Convolutional Neural Network (CNN) for automated classification of white blood cells from microscopic images, achieving 95% accuracy across five cell types.
Author: Muhammad Husnain Ali
- Python - Primary programming language
- TensorFlow - Deep learning framework
- Keras - Neural network API
- Google Colab - Development environment
- NumPy - Numerical computing
- OpenCV - Image processing
- Matplotlib - Visualization
- Scikit-learn - Model evaluation
-
Advanced Image Processing
- Automatic image resizing (128x128)
- Pixel normalization
- Data augmentation with rotations and flips
- Balanced class distribution
-
Robust CNN Architecture
- 4-stage convolutional network
- Batch normalization
- Dropout regularization
- MaxPooling for feature selection
-
Performance Optimization
- Early stopping
- Learning rate scheduling
- Model checkpointing
- GPU acceleration
-
Comprehensive Evaluation
- Confusion matrix analysis
- ROC curve generation
- Per-class accuracy metrics
- Real-time prediction visualization
Input (128x128x3)
│
├── Conv Block 1 (64 filters) → BatchNorm → MaxPool → Dropout(0.25)
│
├── Conv Block 2 (128 filters) → BatchNorm → MaxPool → Dropout(0.25)
│
├── Conv Block 3 (256 filters) → BatchNorm → MaxPool → Dropout(0.25)
│
├── Conv Block 4 (512 filters) → BatchNorm → MaxPool → Dropout(0.25)
│
├── Dense(1024) → Dropout(0.5)
│
├── Dense(512) → Dropout(0.5)
│
└── Output(5) → Softmax
- Source: White Blood Cells Dataset
- Classes: 5 WBC types
- Neutrophils
- Eosinophils
- Basophils
- Monocytes
- Lymphocytes
- Volume: 14,514 images
- Training: 8,140 (80%)
- Validation: 2,035 (20%)
- Test: 4,339
Metric | Score |
---|---|
Training Accuracy | 93.73% |
Validation Accuracy | 94.94% |
Test Accuracy | 95.00% |
Inference Time | <100ms |
from google.colab import drive
drive.mount('/content/drive')
!pip install -r requirements.txt
!kaggle datasets download -d paultimothymooney/blood-cells
!unzip blood-cells.zip
!python train.py --epochs 10 --batch_size 32
tensorflow>=2.8.0
numpy>=1.19.5
opencv-python>=4.5.5
matplotlib>=3.4.3
scikit-learn>=1.0.2
- Use GPU runtime in Colab
- Enable data augmentation
- Start with provided hyperparameters
- Monitor validation metrics
model = load_model('wbc_classifier.h5')
prediction = model.predict(image)
from evaluation import evaluate_model
metrics = evaluate_model(model, test_data)
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature
) - Commit changes (
git commit -m 'Add AmazingFeature'
) - Push to branch (
git push origin feature/AmazingFeature
) - Open Pull Request
For questions and support:
- Open an Issue
- Contact: m.husnainali.work@gmail.com
- Kaggle for the comprehensive dataset
- TensorFlow team for the framework
- Google Colab for free GPU resources
- All contributors to this project
Made with ❤️ by Muhammad Husnain Ali