Views
No views yet
microsoft/swin-base-patch4-window7-224) specifically adapted for satellite image classification tasks. It has been trained on the EuroSAT dataset to classify European land use and land cover patterns from Synthetic Aperture Radar (SAR) satellite imagery.| Class ID | Class Name | Description |
|---|---|---|
| 0 | AnnualCrop | Agricultural areas with annual crops |
| 1 | Forest | Forest areas and wooded landscapes |
| 2 | HerbaceousVegetation | Grasslands and herbaceous vegetation |
| 3 | Highway | Major roads and highway infrastructure |
| 4 | Industrial | Industrial areas and facilities |
| 5 | Pasture | Permanent grasslands used for grazing |
| 6 | PermanentCrop | Orchards, vineyards, and permanent crops |
| 7 | Residential | Urban residential areas |
| 8 | River | Rivers and water channels |
| 9 | SeaLake | Large water bodies (seas and lakes) |
1Learning Rate: 5e-05
2Batch Size: 32
3Training Epochs: 10
4Optimizer: AdamW
5Weight Decay: 0.01
6Warmup Steps: 500
7Mixed Precision: Enabled
8Hardware: CUDA-compatible GPU
9Framework: PyTorch + Transformerspip install transformers torch pillow1from transformers import AutoImageProcessor, AutoModelForImageClassification
2from PIL import Image
3import torch
4
5# Load model and processor
6model_name = "Adilbai/EuroSAT-Swin"
7processor = AutoImageProcessor.from_pretrained(model_name)
8model = AutoModelForImageClassification.from_pretrained(model_name)
9
10# Load and preprocess image
11image = Image.open("satellite_image.jpg")
12inputs = processor(images=image, return_tensors="pt")
13
14# Make prediction
15with torch.no_grad():
16 outputs = model(**inputs)
17 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
18 predicted_class = predictions.argmax().item()
19 confidence = predictions.max().item()
20
21# Class names mapping
22class_names = [
23 "AnnualCrop", "Forest", "HerbaceousVegetation", "Highway", "Industrial",
24 "Pasture", "PermanentCrop", "Residential", "River", "SeaLake"
25]
26
27print(f"Predicted class: {class_names[predicted_class]} (confidence: {confidence:.3f})")1# Process multiple images
2images = [Image.open(f"image_{i}.jpg") for i in range(batch_size)]
3inputs = processor(images=images, return_tensors="pt")
4
5with torch.no_grad():
6 outputs = model(**inputs)
7 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
8 predicted_classes = predictions.argmax(dim=-1)1@article{eurosat2019,
2 title={EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classification},
3 author={Helber, Patrick and Bischke, Benjamin and Dengel, Andreas and Borth, Damian},
4 journal={IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing},
5 volume={12},
6 number={7},
7 pages={2217--2226},
8 year={2019},
9 publisher={IEEE}
10}
11
12@article{swin2021,
13 title={Swin Transformer: Hierarchical Vision Transformer using Shifted Windows},
14 author={Liu, Ze and Lin, Yutong and Cao, Yue and Hu, Han and Wei, Yixuan and Zhang, Zheng and Lin, Stephen and Guo, Baining},
15 journal={Proceedings of the IEEE/CVF International Conference on Computer Vision},
16 pages={10012--10022},
17 year={2021}
18}