| | --- |
| | 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* |