This project implements a Deep Learning model for classifying satellite images from the EuroSAT dataset. The model uses a Convolutional Neural Network (CNN) to recognize and classify land use patterns from satellite imagery captured by the Sentinel-2 satellite.
Masoud Ghasemi
- GitHub: sorna-fast
- Email: [email protected]
- linkedin: masoud-ghasemi
- Telegram: @Masoud_Ghasemi_sorna_fast
.
βββ π datasets/ # Original dataset directory
β βββ EuroSAT_extracted/
β βββ 2750/ # Main dataset folder
βββ π model/ # Trained models
β βββ best_model_epoch.keras # Best trained model
βββ π notebooks/ # Jupyter notebooks
β βββ satellite-and-classifier.ipynb # EuroSAT CNN training notebook
βββ π visualizations/ # Generated plots and charts
β βββ class_distribution.png # Dataset class distribution
β βββ confusion_matrix.png # Model confusion matrix
β βββ dataset_samples.png # Sample images from dataset
β βββ training_history.png # Training progress plots
βββ π requirements.txt # Python dependencies
βββ π README.md # Project documentation
βββ π .gitignore # Git ignore file
- Total Images: 27,000
- Image Size: 64x64 pixels
- Channels: RGB (3 channels)
- Classes: 10 land use types
- AnnualCrop
- Forest
- HerbaceousVegetation
- Highway
- Industrial
- Pasture
- PermanentCrop
- Residential
- River
- SeaLake
| Layer (type) | Output Shape | Param # |
|---|---|---|
| data_augmentation (Sequential) | (None, 64, 64, 3) | 0 |
| conv2d_12 (Conv2D) | (None, 64, 64, 64) | 1,792 |
| batch_normalization_12 (BatchNormalization) | (None, 64, 64, 64) | 256 |
| conv2d_13 (Conv2D) | (None, 64, 64, 64) | 36,928 |
| batch_normalization_13 (BatchNormalization) | (None, 64, 64, 64) | 256 |
| max_pooling2d_6 (MaxPooling2D) | (None, 32, 32, 64) | 0 |
| conv2d_14 (Conv2D) | (None, 32, 32, 256) | 147,712 |
| batch_normalization_14 (BatchNormalization) | (None, 32, 32, 256) | 1,024 |
| max_pooling2d_7 (MaxPooling2D) | (None, 16, 16, 256) | 0 |
| conv2d_15 (Conv2D) | (None, 16, 16, 384) | 885,120 |
| batch_normalization_15 (BatchNormalization) | (None, 16, 16, 384) | 1,536 |
| conv2d_16 (Conv2D) | (None, 16, 16, 384) | 1,327,488 |
| batch_normalization_16 (BatchNormalization) | (None, 16, 16, 384) | 1,536 |
| conv2d_17 (Conv2D) | (None, 16, 16, 256) | 884,992 |
| batch_normalization_17 (BatchNormalization) | (None, 16, 16, 256) | 1,024 |
| max_pooling2d_8 (MaxPooling2D) | (None, 8, 8, 256) | 0 |
| global_average_pooling2d_2 (GlobalAveragePooling2D) | (None, 256) | 0 |
| dense_6 (Dense) | (None, 256) | 65,792 |
| dropout_4 (Dropout) | (None, 256) | 0 |
| dense_7 (Dense) | (None, 256) | 65,792 |
| dropout_5 (Dropout) | (None, 256) | 0 |
| dense_8 (Dense) | (None, 10) | 2,570 |
Total Parameters: 3,423,618
The model was trained for 33 epochs with early stopping. Key training milestones:
- Best Model: Saved at Epoch 28 with 96.44% validation accuracy
- Final Training Accuracy: 97.06% (Epoch 28)
- Training Stopped: Epoch 33 due to early stopping
- Learning Rate Adjustments: Automatically reduced 4 times for optimal convergence
- Overall Accuracy: 96%
- Macro Average F1-Score: 0.96
- Weighted Average F1-Score: 0.96
| Class | Accuracy |
|---|---|
| AnnualCrop | 93.3% |
| Forest | 99.8% (Best) |
| HerbaceousVegetation | 96.0% |
| Highway | 99.0% |
| Industrial | 98.0% |
| Pasture | 94.1% |
| PermanentCrop | 93.7% |
| Residential | 98.4% |
| River | 96.7% |
| SeaLake | 94.9% |
- Best Performing Class: Forest (99.8% accuracy)
- Most Challenging Class: AnnualCrop (93.3% accuracy)
- Most Common Misclassification: AnnualCrop β PermanentCrop (27 samples)
==================================================
Full Classification Report:
==================================================
precision recall f1-score support
AnnualCrop 0.96 0.93 0.95 597
Forest 0.94 1.00 0.97 600
HerbaceousVegetation 0.94 0.96 0.95 557
Highway 0.98 0.99 0.98 493
Industrial 0.97 0.98 0.98 512
Pasture 0.98 0.94 0.96 374
PermanentCrop 0.92 0.94 0.93 491
Residential 0.98 0.98 0.98 607
River 0.98 0.97 0.97 547
SeaLake 1.00 0.95 0.97 622
accuracy 0.96 5400
macro avg 0.96 0.96 0.96 5400
weighted avg 0.97 0.96 0.96 5400
- Python 3.8+
- TensorFlow 2.x
- Jupyter Notebook
- Create virtual environment
python -m venv myvenv
source myvenv/bin/activate # On Windows: myvenv\Scripts\activate- Install dependencies
pip install -r requirements.txt- In Google Colab: Uses Tesla T4 or similar GPU by default
- In local environment: Requires manual installation of CUDA and cuDNN drivers
- Memory settings: You may need to reduce batch size on systems with less GPU memory
# Check GPU support
import tensorflow as tf
print("Number of available GPUs: ", len(tf.config.list_physical_devices('GPU')))- GPU with 8GB+ memory:
BATCH_SIZE = 32 - GPU with 4-8GB memory:
BATCH_SIZE = 16 - CPU only:
BATCH_SIZE = 8
- Open Jupyter Notebook
jupyter notebook-
Choose your preferred notebook:
satellite-and-classifier-en.ipynb- English version
-
Execute cells sequentially to:
- Download and preprocess data
- Train the CNN model
- Evaluate model performance
- Generate visualizations
# Model parameters
IMG_SIZE = (64, 64) # Input image size
BATCH_SIZE = 32 # Training batch size
EPOCHS = 40 # Maximum training epochs
# Data augmentation
data_augmentation = tf.keras.Sequential([
RandomFlip("horizontal_and_vertical"),
RandomRotation(0.25),
RandomTranslation(0.2, 0.2),
RandomZoom(0.2)
])β
Automatic dataset download and extraction
β
Image preprocessing and normalization
β
Efficient data pipeline with caching
β
Balanced dataset handling
β
Custom CNN architecture
β
Comprehensive data augmentation
β
Batch normalization for stable training
β
Dropout for regularization
β
Automatic checkpointing
β
Early stopping
β
Learning rate scheduling
β
Progress monitoring
β
Confusion matrix analysis
β
Classification reports
β
Training history plots
β
Sample image visualization
This model can be used for:
- Land use mapping and monitoring
- Environmental research
- Urban planning
- Agricultural monitoring
- Disaster management
- Climate change studies
This project is for educational purposes. The EuroSAT dataset is provided for research use.
- EuroSAT Dataset: Helber et al. for the satellite imagery dataset
- TensorFlow Team: For the deep learning framework
- Sentinel-2 Mission: For providing satellite imagery
πΏ Using AI to understand our planet better
Achieved 96.4% Accuracy in Satellite Image Classification

