Views
No views yet

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.
1Accuracy: 0.9863
2F1 Score: 0.9858
3
4Classification Report:
5 precision recall f1-score support
6
7 Annual Crop 0.9866 0.9810 0.9838 3000
8 Forest 0.9927 0.9957 0.9942 3000
9Herbaceous Vegetation 0.9697 0.9800 0.9748 3000
10 Highway 0.9826 0.9928 0.9877 2500
11 Industrial 0.9964 0.9916 0.9940 2500
12 Pasture 0.9882 0.9610 0.9744 2000
13 Permanent Crop 0.9690 0.9760 0.9725 2500
14 Residential 0.9940 0.9970 0.9955 3000
15 River 0.9864 0.9872 0.9868 2500
16 Sea Lake 0.9963 0.9923 0.9943 3000
17
18 accuracy 0.9863 27000
19 macro avg 0.9862 0.9855 0.9858 27000
20 weighted avg 0.9863 0.9863 0.9863 27000
!pip install -q transformers torch pillow gradio1import gradio as gr
2from transformers import AutoImageProcessor
3from transformers import SiglipForImageClassification
4from transformers.image_utils import load_image
5from PIL import Image
6import torch
7
8# Load model and processor
9model_name = "prithivMLmods/SAT-Landforms-Classifier"
10model = SiglipForImageClassification.from_pretrained(model_name)
11processor = AutoImageProcessor.from_pretrained(model_name)
12
13def landform_classification(image):
14 """Predicts landform category for a satellite image."""
15 image = Image.fromarray(image).convert("RGB")
16 inputs = processor(images=image, return_tensors="pt")
17
18 with torch.no_grad():
19 outputs = model(**inputs)
20 logits = outputs.logits
21 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
22
23 labels = {
24 "0": "Annual Crop", "1": "Forest", "2": "Herbaceous Vegetation", "3": "Highway", "4": "Industrial",
25 "5": "Pasture", "6": "Permanent Crop", "7": "Residential", "8": "River", "9": "Sea Lake"
26 }
27 predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
28
29 return predictions
30
31# Create Gradio interface
32iface = gr.Interface(
33 fn=landform_classification,
34 inputs=gr.Image(type="numpy"),
35 outputs=gr.Label(label="Prediction Scores"),
36 title="SAT Landforms Classification",
37 description="Upload a satellite image to classify its landform type."
38)
39
40# Launch the app
41if __name__ == "__main__":
42 iface.launch()