Views
No views yet
| Metric | Score |
|---|---|
| Test Accuracy | 98.21% |
| Architecture | ResNet18 (ImageNet pretrained) |
| Training Epochs | 20 |
| Dataset Size | 27,000 images |
| 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 |
1import torch
2from torchvision import models, transforms
3from PIL import Image
4import torch.nn as nn
5
6checkpoint = torch.load('eurosat_resnet18_finetuned.pth', map_location='cpu')
7model = models.resnet18(weights=None)
8model.fc = nn.Sequential(
9 nn.Dropout(0.4), nn.Linear(512, 256), nn.BatchNorm1d(256),
10 nn.ReLU(), nn.Dropout(0.2), nn.Linear(256, 10)
11)
12model.load_state_dict(checkpoint['model_state_dict'])
13model.eval()
14
15transform = transforms.Compose([
16 transforms.Resize((224, 224)),
17 transforms.ToTensor(),
18 transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
19])
20
21img = Image.open('satellite_image.jpg').convert('RGB')
22with torch.no_grad():
23 pred = model(transform(img).unsqueeze(0))
24 class_id = pred.argmax(1).item()
25 print(f"Predicted: {checkpoint['class_names'][class_id]}")