
![4.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/6wc37VzmAH_l6nJ2YmV_D.png)

# **RSI-CB256-07**

> **RSI-CB256-07** is a SigLIP2-based model fine-tuned for **coarse-grained remote sensing land-cover classification**. It distinguishes among 7 essential categories commonly used in environmental, urban planning, and geospatial analysis applications. The model is built on `google/siglip2-base-patch16-224 ` using the `SiglipForImageClassification` architecture.

```py
Classification Report:
                   precision    recall  f1-score   support

   transportation     0.9810    0.9858    0.9834      3300
    other objects     0.9854    0.9932    0.9893       884
         woodland     0.9973    0.9958    0.9966      6258
       water area     0.9870    0.9837    0.9854      4104
       other land     0.9925    0.9919    0.9922      3593
  cultivated land     0.9918    0.9901    0.9909      2817
construction land     0.9945    0.9963    0.9954      3791

         accuracy                         0.9912     24747
        macro avg     0.9899    0.9910    0.9904     24747
     weighted avg     0.9912    0.9912    0.9912     24747
```

![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/TK92T1T135eFWucPmTGqw.png)

---

## **Label Space: 7 Remote Sensing Classes**

This model predicts one of the following categories for a given satellite or aerial image:

```
Class 0:  "transportation"  
Class 1:  "other objects"  
Class 2:  "woodland"  
Class 3:  "water area"  
Class 4:  "other land"  
Class 5:  "cultivated land"  
Class 6:  "construction land"
```

---

## **Install Dependencies**

```bash
pip install -q transformers torch pillow gradio
```

---

## **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/RSI-CB256-07"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

# ID to label mapping
id2label = {
    "0": "transportation",
    "1": "other objects",
    "2": "woodland",
    "3": "water area",
    "4": "other land",
    "5": "cultivated land",
    "6": "construction land"
}

def classify_rsi_image(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=classify_rsi_image,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(num_top_classes=7, label="Predicted Land-Cover Category"),
    title="RSI-CB256-07",
    description="Upload a satellite or aerial image to classify it into one of seven coarse land-cover classes using SigLIP2."
)

if __name__ == "__main__":
    iface.launch()
```

---

## **Applications**

* **Urban vs Rural Segmentation**
* **Land-Use Classification**
* **National/Regional Land Cover Monitoring**
* **Environmental Impact Assessment**
transportation other objects woodland water area other land cultivated land construction land