This project implements deep learning classification on the EuroSAT RGB and multispectral satellite imagery datasets for the mandatory coding task in "Deep Learning for Master Students" module.
.
├── task1.py # Data splitting (train/val/test)
├── task2.py # RGB classification with EfficientNet-B0
├── Final_model.py # Test set evaluation and reproducibility check
├── task3.py # Multispectral classification with late fusion
├── run_all.sh # Script to run all tasks
├── run_task2.sh # SLURM script for cluster (Tasks 1+2)
├── run_task3.sh # SLURM script for cluster (Task 3)
├── environment_minimal.yml # Conda environment specification
└── output/ # All outputs saved here (created automatically)
├── splits/ # Train/val/test split files
├── plots/ # Training curves
├── ranked_images/ # Top-5 and bottom-5 images per class
├── best_model_weights.pth # Best RGB model
├── best_model_task3.pth # Best multispectral model
├── test_logits.pt # Saved logits for reproducibility
└── mean_std_cache.pt # Dataset statistics cache
Edit run_all.sh and set the project path at the top of the file:
export PROJECT_ROOT="/absolute/path/to/this/project"Note: Datasets will be automatically downloaded to $HOME/datasets/ if not already present.
You can change the DATASET_BASE variable in run_all.sh if you want them elsewhere.
bash run_all.shThis single command will:
- Create and activate the conda environment (
dl_task_env) - Run Task 1 (data splitting)
- Run Task 2 (RGB classification)
- Run Final_model.py (test evaluation)
- Run Task 3 (multispectral classification, if dataset path is set)
All outputs will be saved to output/ directory.
Creates reproducible train/val/test splits (2500/1000/2000 images total).
export PROJECT_ROOT="/path/to/project"
export DATASET_ROOT="/path/to/EuroSAT_RGB"
python task1.pyOutput: output/splits/train.txt, output/splits/val.txt, output/splits/test.txt
Trains EfficientNet-B0 with different learning rates and augmentation settings.
python task2.pyOutput:
output/best_model_weights.pth- Best model weightsoutput/plots/results.png- Training curves (accuracy & TPR)output/mean_std_cache.pt- Dataset statistics
Evaluates the best model and generates visualizations.
python Final_model.pyOutput:
output/test_logits.pt- Logits for reproducibility checkoutput/ranked_images/class_*_top5_bottom5.png- Top/bottom scoring images
Reproducibility check: To compare newly computed logits with saved ones, edit Final_model.py line 220:
# Change from:
evaluate(..., save_logits=True, compare_logits=False)
# To:
evaluate(..., save_logits=False, compare_logits=True)Late-fusion classification using 6 bands from EuroSAT_MS dataset.
export DATASET_ROOT="/path/to/EuroSAT_MS"
python task3.pyOutput: output/best_model_task3.pth
- Splitting: Per-class stratified splitting using
sklearn.train_test_split - Reproducibility: Fixed random seed (3745356)
- Verification: Checks that splits are disjoint
- Model: EfficientNet-B0 pretrained on ImageNet
- Augmentations tested: None, ColorJitter, GaussianBlur
- Learning rates tested: 0.01, 0.001
- Optimizer: SGD with momentum (0.9)
- Epochs: 10
- Metrics: Accuracy, average TPR per class
- Model: EfficientNet-B0 with late fusion
- Bands used: B02, B03, B04, B08, B11, B12 (indices 1,2,3,7,10,11)
- Architecture:
- Same feature extractor processes two groups of 3 bands (shared weights)
- Features concatenated after global average pooling
- Single linear layer for classification
- Normalization: [0, 65535] → [0, 1], then per-band standardization
For execution on the Uni cluster, use the provided SLURM scripts:
# RGB classification (Tasks 1 + 2 + evaluation)
sbatch run_task2.sh
# Multispectral classification (Task 3)
sbatch run_task3.shEdit the scripts to set:
#SBATCHparameters (partition, time, resources)PROJECT_ROOTandDATASET_ROOTpaths
- Python 3.11
- PyTorch + torchvision
- scikit-learn, scikit-image
- matplotlib, numpy, pandas, pillow
All dependencies are listed in environment_minimal.yml.
To verify reproducibility:
- Run
Final_model.pywithsave_logits=True→ saves logits - Run again with
compare_logits=True→ compares new vs. saved logits