- Overview
- Dataset Information
- Model Architecture
- Performance Metrics
- Data Visualization
- Installation & Usage
- Results & Analysis
- Future Improvements
- References
This project implements deep learning models for automated COVID-19 detection from CT scan images using PyTorch. The notebook demonstrates two approaches:
- Custom CNN Architecture - Achieving 92% accuracy
- DenseNet Transfer Learning - Achieving 96% accuracy
- β Binary classification (COVID-19 vs Non-COVID-19)
- β Transfer learning implementation
- β Data augmentation techniques
- β Model comparison and evaluation
- β Visualization of predictions and feature maps
The dataset contains CT scan images collected from real patients:
Dataset Structure:
βββ COVID-19/ # CT scans from COVID-19 positive patients
β βββ ~1,252 images
βββ Non-COVID/ # CT scans from healthy or other pneumonia patients
βββ ~1,229 images
Total Images: ~2,481 CT scans
Image Format: PNG
Image Size: Variable (resized to 224x224 for training)
| Metric | Value |
|---|---|
| Total Images | 2,481 |
| COVID-19 Cases | 1,252 (51%) |
| Non-COVID Cases | 1,229 (49%) |
| Training Set | 2108 (85%) |
| Validation Set | 186 (7.5%) |
| Test Set | 187 (7.5%) |
| Class / Set | Training | Validation | Test |
|---|---|---|---|
| COVID-19 Cases | 1055 | 100 | 97 |
| Non-COVID Cases | 1053 | 86 | 90 |
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| Custom CNN | 92.0% | 92.0% | 92.0% | 92.0% |
| DenseNet-69 | 96.0% | 96.0% | 96.0% | 96.0% |
# Clone the repository
git clone https://github.com/yourusername/covid19-ct-classification.git
cd covid19-ct-classification
# Create Virtual Environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt-
DenseNet Outperforms CNN
- 4% accuracy improvement over custom CNN
- Better generalization on test set
- Fewer false negatives (critical for medical diagnosis)
-
Transfer Learning Benefits
- Faster convergence (15 epochs vs 35 epochs)
- Better feature extraction from pre-trained weights
- More robust to small dataset size
-
Error Analysis
- Most false positives: Early-stage COVID cases
- Most false negatives: Atypical CT presentations
- Confusion mainly in borderline cases
Hyperparameters:
βββββββββββββββββββββββββββββββββββ
Custom CNN:
β’ Optimizer: Adam
β’ Learning Rate: 5e-5
β’ Batch Size: 16
β’ Epochs: 50
DenseNet-69:
β’ Optimizer: Adam
β’ Learning Rate: 3e-5
β’ Batch Size: 16
β’ Epochs: 50 finished 27
β’ Weight Decay: 0.01
β’ LR Scheduler: ReduceLROnPlateauTraining Augmentations:
β’ Random Horizontal Flip (p=0.5)
β’ Random Vertical Flip (p=0.5)
β’ Random Rotation (Β±10Β°)
β’ Normalization (ImageNet stats)- Implement ensemble methods (CNN + DenseNet)
- Add Grad-CAM visualizations for interpretability
- Experiment with other architectures (EfficientNet)
- Increase dataset size through additional sources
- Multi-class classification (COVID vs Pneumonia vs Normal)
- 3D CNN for volumetric CT analysis
- Real-time deployment as web application
- SARS-CoV-2 CT Scan Dataset: Kaggle
- GANs for Kidney and Brain Tumors
- MRI Brain Tumor Classification
- Medical Text Classification using BiLSTM, BiGRU & Conv1D
- ECG Signal Classification using RNN, GRU & LSTM
Contributions are welcome! Please feel free to submit a Pull Request.
For questions or collaboration opportunities:
- Kaggle: ahmedashrafhelmi
- Project Link: COVID-19 CT Classification Notebook



