Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- swin-transformer
|
| 7 |
+
- satellite-imagery
|
| 8 |
+
- image-classification
|
| 9 |
+
- pytorch
|
| 10 |
+
- computer-vision
|
| 11 |
+
pipeline_tag: image-classification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Swin Transformer — Satellite Image Classification
|
| 15 |
+
|
| 16 |
+
PyTorch implementation of Swin Transformer (Liu et al. 2021) trained on NWPU-RESISC45 satellite imagery dataset.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
|
| 20 |
+
| Property | Value |
|
| 21 |
+
|---|---|
|
| 22 |
+
| Architecture | Swin Transformer (4 stages) |
|
| 23 |
+
| Dataset | NWPU-RESISC45 |
|
| 24 |
+
| Classes | 45 land use categories |
|
| 25 |
+
| Test Accuracy | 82% |
|
| 26 |
+
| Input Size | 224×224 |
|
| 27 |
+
| Embed Dim | 96 |
|
| 28 |
+
| Training Hardware | RTX 4050 6GB |
|
| 29 |
+
| Framework | PyTorch (from scratch) |
|
| 30 |
+
|
| 31 |
+
## Classes
|
| 32 |
+
airplane, airport, baseball_diamond, basketball_court, beach, bridge,
|
| 33 |
+
chaparral, church, circular_farmland, cloud, commercial_area, dense_residential,
|
| 34 |
+
desert, forest, freeway, golf_course, ground_track_field, harbor, industrial_area,
|
| 35 |
+
intersection, island, lake, meadow, medium_residential, mobile_home_park,
|
| 36 |
+
mountain, overpass, palace, parking_lot, railway, railway_station,
|
| 37 |
+
rectangular_farmland, river, roundabout, runway, sea_ice, ship, snowberg,
|
| 38 |
+
sparse_residential, stadium, storage_tank, tennis_court, terrace, thermal_power_station, wetland
|
| 39 |
+
|
| 40 |
+
## Usage
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from huggingface_hub import hf_hub_download
|
| 44 |
+
import torch
|
| 45 |
+
from torchvision import transforms
|
| 46 |
+
from PIL import Image
|
| 47 |
+
|
| 48 |
+
checkpoint = torch.load(
|
| 49 |
+
hf_hub_download("Sathya77/swin-transformer-satellite", "swin_resisc45.pth"),
|
| 50 |
+
map_location='cpu'
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
model = SwinTransformer(embed_dim=96, num_classes=45)
|
| 54 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
| 55 |
+
model.eval()
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Live Demo
|
| 59 |
+
Try it here: [Sathya77/swin-transformer-satellite](https://huggingface.co/spaces/Sathya77/swin-transformer-satellite)
|
| 60 |
+
|
| 61 |
+
## References
|
| 62 |
+
- [Swin Transformer Paper](https://arxiv.org/abs/2103.14030) — Liu et al. 2021
|
| 63 |
+
- [NWPU-RESISC45 Dataset](http://www.escience.cn/people/JunweiHan/NWPU-RESISC45.html)
|