RSI-CB256-35 is a vision-language encoder model fine-tuned from google/siglip2-base-patch16-224 for multi-class remote sensing image classification. Built using the SiglipForImageClassification architecture, it is designed to accurately categorize overhead imagery into 35 distinct land-use and land-cover categories.
py
1Classification Report:2 precision recall f1-score support
34 parking lot 0.99780.98720.99254675 avenue 0.99271.00000.99635446 highway 0.92830.98650.95652237 bridge 0.92830.96590.94674698 marina 0.99461.00000.99733669 crossroads 0.99090.98010.985555310 airport runway 0.99560.99260.994167811 pipeline 0.99001.00000.995019812 town 0.99701.00000.998533513 airplane 0.99150.99150.991535114 forest 0.99720.99450.9958108215 mangrove 1.00001.00001.0000104916 artificial grassland 0.98210.97170.976928317river protection forest 1.00001.00001.000052418 shrubwood 1.00001.00001.0000133119 sapling 0.99551.00000.997787920 sparse forest 1.00001.00001.0000111021 lakeshore 1.00001.00001.000043822 river 0.96800.95550.961753923 stream 1.00000.99710.998568824 coastline 0.99130.99780.994645925 hirst 0.98901.00000.994562826 dam 0.98680.92590.955432427 sea 0.99710.98640.9917102828 snow mountain 1.00001.00001.0000115329 sandbeach 0.99440.99070.992553630 mountain 0.99260.99380.993281231 desert 0.97570.99270.9841109232 dry farm 1.00000.99920.9996130933 green farmland 0.99840.99690.997764434 bare land 0.98700.96300.974886435 city building 0.97850.98920.9838101436 residents 0.99260.98770.990181037 container 0.99700.99550.996266038 storage room 0.99851.00000.999213073940 accuracy 0.99192474741 macro avg 0.98940.98970.98952474742 weighted avg 0.99200.99190.991924747
Label Space: 35 Remote Sensing Classes
This model supports the classification of satellite or aerial images into the following classes:
Class 0: "parking lot"
Class 1: "avenue"
Class 2: "highway"
Class 3: "bridge"
Class 4: "marina"
Class 5: "crossroads"
Class 6: "airport runway"
Class 7: "pipeline"
Class 8: "town"
Class 9: "airplane"
Class 10: "forest"
Class 11: "mangrove"
Class 12: "artificial grassland"
Class 13: "river protection forest"
Class 14: "shrubwood"
Class 15: "sapling"
Class 16: "sparse forest"
Class 17: "lakeshore"
Class 18: "river"
Class 19: "stream"
Class 20: "coastline"
Class 21: "hirst"
Class 22: "dam"
Class 23: "sea"
Class 24: "snow mountain"
Class 25: "sandbeach"
Class 26: "mountain"
Class 27: "desert"
Class 28: "dry farm"
Class 29: "green farmland"
Class 30: "bare land"
Class 31: "city building"
Class 32: "residents"
Class 33: "container"
Class 34: "storage room"
Install Dependencies
pip install -q transformers torch pillow gradio
Inference Code
python
1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
56# Load model and processor7model_name ="prithivMLmods/RSI-CB256-35"8model = SiglipForImageClassification.from_pretrained(model_name)9processor = AutoImageProcessor.from_pretrained(model_name)1011# ID to label mapping12id2label ={13"0":"parking lot",14"1":"avenue",15"2":"highway",16"3":"bridge",17"4":"marina",18"5":"crossroads",19"6":"airport runway",20"7":"pipeline",21"8":"town",22"9":"airplane",23"10":"forest",24"11":"mangrove",25"12":"artificial grassland",26"13":"river protection forest",27"14":"shrubwood",28"15":"sapling",29"16":"sparse forest",30"17":"lakeshore",31"18":"river",32"19":"stream",33"20":"coastline",34"21":"hirst",35"22":"dam",36"23":"sea",37"24":"snow mountain",38"25":"sandbeach",39"26":"mountain",40"27":"desert",41"28":"dry farm",42"29":"green farmland",43"30":"bare land",44"31":"city building",45"32":"residents",46"33":"container",47"34":"storage room"48}4950defclassify_rsi_image(image):51 image = Image.fromarray(image).convert("RGB")52 inputs = processor(images=image, return_tensors="pt")5354with torch.no_grad():55 outputs = model(**inputs)56 logits = outputs.logits
57 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()5859 prediction ={60 id2label[str(i)]:round(probs[i],3)for i inrange(len(probs))61}6263return prediction
6465# Gradio Interface66iface = gr.Interface(67 fn=classify_rsi_image,68 inputs=gr.Image(type="numpy"),69 outputs=gr.Label(num_top_classes=5, label="Top-5 Predicted Categories"),70 title="RSI-CB256-35",71 description="Remote sensing image classification using SigLIP2. Upload an aerial or satellite image to classify its land-use category."72)7374if __name__ =="__main__":75 iface.launch()