Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
```py
|
| 5 |
Accuracy: 0.9863
|
| 6 |
F1 Score: 0.9858
|
|
@@ -25,3 +29,76 @@ Herbaceous Vegetation 0.9697 0.9800 0.9748 3000
|
|
| 25 |
```
|
| 26 |
|
| 27 |

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
# **SAT-Landforms-Classifier**
|
| 5 |
+
|
| 6 |
+
> **SAT-Landforms-Classifier** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to classify satellite images into different landform categories using the **SiglipForImageClassification** architecture.
|
| 7 |
+
|
| 8 |
```py
|
| 9 |
Accuracy: 0.9863
|
| 10 |
F1 Score: 0.9858
|
|
|
|
| 29 |
```
|
| 30 |
|
| 31 |

|
| 32 |
+
|
| 33 |
+
The model categorizes images into ten classes:
|
| 34 |
+
- **Class 0:** "Annual Crop"
|
| 35 |
+
- **Class 1:** "Forest"
|
| 36 |
+
- **Class 2:** "Herbaceous Vegetation"
|
| 37 |
+
- **Class 3:** "Highway"
|
| 38 |
+
- **Class 4:** "Industrial"
|
| 39 |
+
- **Class 5:** "Pasture"
|
| 40 |
+
- **Class 6:** "Permanent Crop"
|
| 41 |
+
- **Class 7:** "Residential"
|
| 42 |
+
- **Class 8:** "River"
|
| 43 |
+
- **Class 9:** "Sea Lake"
|
| 44 |
+
|
| 45 |
+
# **Run with Transformers🤗**
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
!pip install -q transformers torch pillow gradio
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
import gradio as gr
|
| 53 |
+
from transformers import AutoImageProcessor
|
| 54 |
+
from transformers import SiglipForImageClassification
|
| 55 |
+
from transformers.image_utils import load_image
|
| 56 |
+
from PIL import Image
|
| 57 |
+
import torch
|
| 58 |
+
|
| 59 |
+
# Load model and processor
|
| 60 |
+
model_name = "prithivMLmods/SAT-Landforms-Classifier"
|
| 61 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 62 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 63 |
+
|
| 64 |
+
def landform_classification(image):
|
| 65 |
+
"""Predicts landform category for a satellite image."""
|
| 66 |
+
image = Image.fromarray(image).convert("RGB")
|
| 67 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 68 |
+
|
| 69 |
+
with torch.no_grad():
|
| 70 |
+
outputs = model(**inputs)
|
| 71 |
+
logits = outputs.logits
|
| 72 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 73 |
+
|
| 74 |
+
labels = {
|
| 75 |
+
"0": "Annual Crop", "1": "Forest", "2": "Herbaceous Vegetation", "3": "Highway", "4": "Industrial",
|
| 76 |
+
"5": "Pasture", "6": "Permanent Crop", "7": "Residential", "8": "River", "9": "Sea Lake"
|
| 77 |
+
}
|
| 78 |
+
predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
|
| 79 |
+
|
| 80 |
+
return predictions
|
| 81 |
+
|
| 82 |
+
# Create Gradio interface
|
| 83 |
+
iface = gr.Interface(
|
| 84 |
+
fn=landform_classification,
|
| 85 |
+
inputs=gr.Image(type="numpy"),
|
| 86 |
+
outputs=gr.Label(label="Prediction Scores"),
|
| 87 |
+
title="SAT Landforms Classification",
|
| 88 |
+
description="Upload a satellite image to classify its landform type."
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
# Launch the app
|
| 92 |
+
if __name__ == "__main__":
|
| 93 |
+
iface.launch()
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
# **Intended Use:**
|
| 97 |
+
|
| 98 |
+
The **SAT-Landforms-Classifier** model is designed to classify satellite images into various landform types. Potential use cases include:
|
| 99 |
+
|
| 100 |
+
- **Land Use Monitoring:** Identifying different land use patterns from satellite imagery.
|
| 101 |
+
- **Environmental Studies:** Supporting researchers in tracking changes in vegetation and water bodies.
|
| 102 |
+
- **Urban Planning:** Assisting planners in analyzing residential, industrial, and infrastructure distributions.
|
| 103 |
+
- **Agricultural Analysis:** Helping assess crop distribution and pastureland areas.
|
| 104 |
+
- **Disaster Management:** Providing insights into land coverage for emergency response and recovery planning.
|