File size: 4,333 Bytes
9cdeb7c 4ff4f31 886bf51 2cffc1c 4ff4f31 886bf51 4ff4f31 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
---
license: apache-2.0
datasets:
- jonathan-roberts1/GID
language:
- en
base_model:
- google/siglip2-base-patch16-224
pipeline_tag: image-classification
library_name: transformers
tags:
- Gaofen-Image-Dataset
- Land-Cover-Classification
- Remote-Sensing-Images
---

# **GiD-Land-Cover-Classification**
> **GiD-Land-Cover-Classification** is a multi-class image classification model based on `google/siglip2-base-patch16-224`, trained to detect **land cover types** in geographical or environmental imagery. This model can be used for **urban planning**, **agriculture monitoring**, and **environmental analysis**.
```py
Classification Report:
precision recall f1-score support
arbor woodland 0.8868 0.9130 0.8997 2000
artificial grassland 0.9173 0.9425 0.9297 2000
dry cropland 0.9320 0.9395 0.9358 2000
garden plot 0.8639 0.8380 0.8508 2000
industrial land 0.8967 0.8940 0.8953 2000
irrigated land 0.8817 0.7865 0.8314 2000
lake 0.7597 0.8045 0.7814 2000
natural grassland 0.9770 0.9750 0.9760 2000
paddy field 0.9305 0.9580 0.9441 2000
pond 0.7646 0.7405 0.7523 2000
river 0.8124 0.7945 0.8033 2000
rural residential 0.8875 0.8325 0.8591 2000
shrub land 0.8936 0.9195 0.9064 2000
traffic land 0.9577 0.9510 0.9543 2000
urban residential 0.7821 0.8470 0.8133 2000
accuracy 0.8757 30000
macro avg 0.8762 0.8757 0.8755 30000
weighted avg 0.8762 0.8757 0.8755 30000
```

---
## **Label Classes**
The model distinguishes between the following land cover types:
```
0: arbor woodland
1: artificial grassland
2: dry cropland
3: garden plot
4: industrial land
5: irrigated land
6: lake
7: natural grassland
8: paddy field
9: pond
10: river
11: rural residential
12: shrub land
13: traffic land
14: urban residential
```
---
## **Installation**
```bash
pip install transformers torch pillow gradio
```
---
## **Example Inference Code**
```python
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch
# Load model and processor
model_name = "prithivMLmods/GiD-Land-Cover-Classification"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
# ID to label mapping
id2label = {
"0": "arbor woodland",
"1": "artificial grassland",
"2": "dry cropland",
"3": "garden plot",
"4": "industrial land",
"5": "irrigated land",
"6": "lake",
"7": "natural grassland",
"8": "paddy field",
"9": "pond",
"10": "river",
"11": "rural residential",
"12": "shrub land",
"13": "traffic land",
"14": "urban residential"
}
def detect_land_cover(image):
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
prediction = {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
return prediction
# Gradio Interface
iface = gr.Interface(
fn=detect_land_cover,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(num_top_classes=5, label="Land Cover Type"),
title="GiD-Land-Cover-Classification",
description="Upload an image to classify its land cover type: arbor woodland, dry cropland, lake, river, traffic land, etc."
)
if __name__ == "__main__":
iface.launch()
```
---
## **Applications**
* **Urban Development Planning**
* **Agricultural Monitoring**
* **Land Use and Land Cover (LULC) Mapping**
* **Disaster Management and Flood Risk Analysis** |