π°οΈ EuroSAT Satellite Image Classifier
Model Description
Fine-tuned ResNet18 on the EuroSAT dataset for satellite image land use classification. The model classifies Sentinel-2 satellite imagery (10m resolution) into 10 land use/cover categories.
Performance
| Metric | Score |
|---|---|
| Test Accuracy | 98.21% |
| Architecture | ResNet18 (ImageNet pretrained) |
| Training Epochs | 20 |
| Dataset Size | 27,000 images |
Classes
| Class | Description |
|---|---|
| πΎ AnnualCrop | Annual cropland |
| π² Forest | Dense forest areas |
| πΏ HerbaceousVegetation | Natural vegetation |
| π£οΈ Highway | Road infrastructure |
| π Industrial | Industrial zones |
| π Pasture | Grazing land |
| π³ PermanentCrop | Orchards, vineyards |
| ποΈ Residential | Urban residential areas |
| ποΈ River | Rivers and waterways |
| π SeaLake | Seas and lakes |
Usage
import torch
from torchvision import models, transforms
from PIL import Image
import torch.nn as nn
checkpoint = torch.load('eurosat_resnet18_finetuned.pth', map_location='cpu')
model = models.resnet18(weights=None)
model.fc = nn.Sequential(
nn.Dropout(0.4), nn.Linear(512, 256), nn.BatchNorm1d(256),
nn.ReLU(), nn.Dropout(0.2), nn.Linear(256, 10)
)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
])
img = Image.open('satellite_image.jpg').convert('RGB')
with torch.no_grad():
pred = model(transform(img).unsqueeze(0))
class_id = pred.argmax(1).item()
print(f"Predicted: {checkpoint['class_names'][class_id]}")
Dataset
EuroSAT RGB - 27,000 labeled Sentinel-2 satellite images.
Training Details
- Base model: ResNet18 (ImageNet pretrained)
- Fine-tuned layers: layer3 + layer4 + fc head
- Optimizer: AdamW (lr=1e-3, weight_decay=0.01)
- Scheduler: OneCycleLR (max_lr=3e-3)
- Augmentation: RandomFlip, Rotation, ColorJitter, Affine
- Label smoothing: 0.1