prithivMLmods commited on
Commit
4ff4f31
·
verified ·
1 Parent(s): 886bf51

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -0
README.md CHANGED
@@ -2,7 +2,20 @@
2
  license: apache-2.0
3
  datasets:
4
  - jonathan-roberts1/GID
 
 
 
 
 
 
 
 
 
 
5
  ---
 
 
 
6
 
7
  ```py
8
  Classification Report:
@@ -31,3 +44,103 @@ artificial grassland 0.9173 0.9425 0.9297 2000
31
 
32
  ![Untitled.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/09-cU54xSrM97DKD66LeU.png)
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  datasets:
4
  - jonathan-roberts1/GID
5
+ language:
6
+ - en
7
+ base_model:
8
+ - google/siglip2-base-patch16-224
9
+ pipeline_tag: image-classification
10
+ library_name: transformers
11
+ tags:
12
+ - Gaofen-Image-Dataset
13
+ - Land-Cover-Classification
14
+ - Remote-Sensing-Images
15
  ---
16
+ # **GiD-Land-Cover-Classification**
17
+
18
+ > **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**.
19
 
20
  ```py
21
  Classification Report:
 
44
 
45
  ![Untitled.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/09-cU54xSrM97DKD66LeU.png)
46
 
47
+
48
+ ---
49
+
50
+ ## **Label Classes**
51
+
52
+ The model distinguishes between the following land cover types:
53
+
54
+ ```
55
+ 0: arbor woodland
56
+ 1: artificial grassland
57
+ 2: dry cropland
58
+ 3: garden plot
59
+ 4: industrial land
60
+ 5: irrigated land
61
+ 6: lake
62
+ 7: natural grassland
63
+ 8: paddy field
64
+ 9: pond
65
+ 10: river
66
+ 11: rural residential
67
+ 12: shrub land
68
+ 13: traffic land
69
+ 14: urban residential
70
+ ```
71
+
72
+ ---
73
+
74
+ ## **Installation**
75
+
76
+ ```bash
77
+ pip install transformers torch pillow gradio
78
+ ```
79
+
80
+ ---
81
+
82
+ ## **Example Inference Code**
83
+
84
+ ```python
85
+ import gradio as gr
86
+ from transformers import AutoImageProcessor, SiglipForImageClassification
87
+ from PIL import Image
88
+ import torch
89
+
90
+ # Load model and processor
91
+ model_name = "prithivMLmods/GiD-Land-Cover-Classification"
92
+ model = SiglipForImageClassification.from_pretrained(model_name)
93
+ processor = AutoImageProcessor.from_pretrained(model_name)
94
+
95
+ # ID to label mapping
96
+ id2label = {
97
+ "0": "arbor woodland",
98
+ "1": "artificial grassland",
99
+ "2": "dry cropland",
100
+ "3": "garden plot",
101
+ "4": "industrial land",
102
+ "5": "irrigated land",
103
+ "6": "lake",
104
+ "7": "natural grassland",
105
+ "8": "paddy field",
106
+ "9": "pond",
107
+ "10": "river",
108
+ "11": "rural residential",
109
+ "12": "shrub land",
110
+ "13": "traffic land",
111
+ "14": "urban residential"
112
+ }
113
+
114
+ def detect_land_cover(image):
115
+ image = Image.fromarray(image).convert("RGB")
116
+ inputs = processor(images=image, return_tensors="pt")
117
+
118
+ with torch.no_grad():
119
+ outputs = model(**inputs)
120
+ logits = outputs.logits
121
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
122
+
123
+ prediction = {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
124
+ return prediction
125
+
126
+ # Gradio Interface
127
+ iface = gr.Interface(
128
+ fn=detect_land_cover,
129
+ inputs=gr.Image(type="numpy"),
130
+ outputs=gr.Label(num_top_classes=5, label="Land Cover Type"),
131
+ title="GiD-Land-Cover-Classification",
132
+ description="Upload an image to classify its land cover type: arbor woodland, dry cropland, lake, river, traffic land, etc."
133
+ )
134
+
135
+ if __name__ == "__main__":
136
+ iface.launch()
137
+ ```
138
+
139
+ ---
140
+
141
+ ## **Applications**
142
+
143
+ * **Urban Development Planning**
144
+ * **Agricultural Monitoring**
145
+ * **Land Use and Land Cover (LULC) Mapping**
146
+ * **Disaster Management and Flood Risk Analysis**