File size: 3,982 Bytes
0184c53 7992750 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ---
title: Astronomy Image Classification
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: "1.28.0"
app_file: app.py
pinned: false
license: mit
---
# ๐ Astronomy Image Classification - Ensemble Model
A deep learning ensemble system for classifying astronomy images into 6 categories using ResNet50 and DenseNet121 models with soft voting.
## Model Performance
- **ResNet50 Accuracy**: 64.86%
- **DenseNet121 Accuracy**: 63.96%
- **Ensemble Expected Accuracy**: 70-75%
- **Target Accuracy**: >95%
- **Architecture**: ResNet50 + DenseNet121 Ensemble
- **Framework**: PyTorch
- **Input Size**: 224x224 pixels
## Ensemble Method
This system uses **soft voting** to combine predictions from both models:
1. Each model makes independent predictions
2. Probabilities are averaged across models
3. Final prediction is the class with highest average probability
4. Provides higher accuracy than individual models
## ๐ Classes
1. **๐ Constellation** - Star patterns forming recognizable shapes (Orion, Big Dipper)
2. ** Cosmos** - General space scenes and cosmic phenomena
3. ** Galaxies** - Spiral, elliptical, and irregular galaxies (Andromeda, Milky Way)
4. **๐ซ Nebula** - Gas clouds and stellar nurseries (Orion Nebula, Eagle Nebula)
5. **๐ช Planets** - Solar system planets and planetary features (Jupiter, Saturn, Mars)
6. **โญ Stars** - Individual stars and stellar objects
## ๐ Usage
1. **Upload** an astronomy image (JPG, PNG, JPEG)
2. **View** individual model predictions
3. **See** ensemble prediction with confidence scores
4. **Explore** all class probabilities
## ๐ง Technical Details
- **Models**: ResNet50 (95MB) + DenseNet121 (30MB)
- **Preprocessing**: Resize to 224x224, ImageNet normalization
- **Augmentation**: Albumentations library
- **Optimization**: AdamW with cosine scheduling
- **Loss Function**: CrossEntropy with class weights
- **Ensemble**: Soft voting (average probabilities)
## ๐ Individual Model Results
| Model | Accuracy | Precision | Recall | F1-Score |
|-------|----------|-----------|--------|----------|
| ResNet50 | 64.86% | 0.6594 | 0.6486 | 0.6452 |
| DenseNet121 | 63.96% | 0.6461 | 0.6396 | 0.6172 |
| **Ensemble** | **~70%** | **Higher** | **Higher** | **Higher** |
## ๐จ Sample Images
Upload images of:
- **Constellations**: Star patterns, asterisms
- **Galaxies**: Spiral, elliptical, irregular galaxies
- **Nebulae**: Emission, reflection, dark nebulae
- **Planets**: Solar system planets, planetary features
- **Stars**: Individual stars, stellar phenomena
- **Cosmos**: Deep space, cosmic phenomena
## ๐ Deployment Features
- โ
**Interactive Web Interface** - Easy image upload
- โ
**Real-time Predictions** - Instant classification
- โ
**Ensemble Results** - Both individual and combined predictions
- โ
**Confidence Scores** - Visual confidence indicators
- โ
**All Class Probabilities** - Complete probability breakdown
- โ
**Mobile Friendly** - Responsive design
- โ
**Error Handling** - Robust error management
## ๐ฎ Future Improvements
- **Test Time Augmentation (TTA)** - Multiple augmented predictions
- **More Models** - Add EfficientNet, Vision Transformer
- **Advanced Ensemble** - Weighted voting based on performance
- **Progressive Training** - Multi-stage training approach
- **Data Augmentation** - More aggressive augmentation
- **Transfer Learning** - Pre-training on larger datasets
##๏ธ Local Testing
```bash
# Install dependencies
pip install -r requirements.txt
# Run locally
streamlit run app.py
```
## ๐ Model Files
- `best_resnet50.pth` - ResNet50 model weights (95MB)
- `best_densenet121.pth` - DenseNet121 model weights (30MB)
- `model.py` - Model architecture definition
- `inference.py` - Inference pipeline with ensemble
- `app.py` - Streamlit web application
---
* Built with โค๏ธ for astronomy enthusiasts and data scientists*
*๐ฏ Target: >95% accuracy through ensemble methods and advanced techniques* |