|
|
--- |
|
|
datasets: |
|
|
- marcelomoreno26/geoguessr |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- en |
|
|
base_model: |
|
|
- google/siglip2-base-patch16-224 |
|
|
pipeline_tag: image-classification |
|
|
library_name: transformers |
|
|
tags: |
|
|
- GeoGuessr |
|
|
- '55' |
|
|
- Loaction |
|
|
- RSI |
|
|
- Remote Sensing Instruments |
|
|
--- |
|
|
|
|
|
 |
|
|
|
|
|
# **GeoGuessr-55** |
|
|
|
|
|
> **GeoGuessr-55** is a visual geolocation classification model that predicts the **country** from a single image. Based on the `SigLIP2` architecture, this model can classify images into one of **55 countries** using visual features such as landscapes, signs, vegetation, and architecture. It is useful for location-based games, geographic AI research, and image-based country inference. |
|
|
|
|
|
```py |
|
|
Classification Report: |
|
|
precision recall f1-score support |
|
|
|
|
|
Argentina 0.5292 0.5083 0.5185 482 |
|
|
Australia 0.7850 0.8146 0.7995 1192 |
|
|
Austria 0.6199 0.4380 0.5133 242 |
|
|
Bangladesh 0.4583 0.1486 0.2245 74 |
|
|
Belgium 0.2500 0.0065 0.0127 153 |
|
|
Bolivia 0.0000 0.0000 0.0000 81 |
|
|
Botswana 0.5263 0.2000 0.2899 100 |
|
|
Brazil 0.6562 0.8356 0.7351 1624 |
|
|
Bulgaria 0.5091 0.3709 0.4291 151 |
|
|
Cambodia 0.0000 0.0000 0.0000 82 |
|
|
Canada 0.7464 0.7973 0.7710 967 |
|
|
Chile 0.5000 0.1360 0.2138 228 |
|
|
Colombia 0.3191 0.0857 0.1351 175 |
|
|
Croatia 0.6667 0.0222 0.0430 90 |
|
|
Czechia 0.5000 0.0335 0.0628 179 |
|
|
Denmark 0.0000 0.0000 0.0000 138 |
|
|
Finland 0.6609 0.8338 0.7373 734 |
|
|
France 0.6129 0.7913 0.6908 2501 |
|
|
Germany 0.7943 0.8627 0.8271 488 |
|
|
Ghana 0.4706 0.1081 0.1758 74 |
|
|
Greece 0.3684 0.0809 0.1327 173 |
|
|
Hungary 0.5000 0.0342 0.0640 117 |
|
|
India 0.8261 0.5089 0.6298 112 |
|
|
Indonesia 0.6211 0.2935 0.3986 201 |
|
|
Ireland 0.6316 0.0591 0.1081 203 |
|
|
Israel 0.5427 0.5570 0.5498 228 |
|
|
Italy 0.4092 0.2736 0.3279 552 |
|
|
Japan 0.7996 0.9632 0.8738 2688 |
|
|
Kenya 0.4359 0.1868 0.2615 91 |
|
|
Latvia 0.0000 0.0000 0.0000 81 |
|
|
Lithuania 0.0000 0.0000 0.0000 98 |
|
|
Malaysia 0.5413 0.3986 0.4591 296 |
|
|
Mexico 0.4721 0.4571 0.4645 630 |
|
|
Netherlands 0.5101 0.3753 0.4324 405 |
|
|
New Zealand 0.6910 0.5116 0.5879 389 |
|
|
Nigeria 0.4000 0.3488 0.3727 86 |
|
|
Norway 0.7384 0.7055 0.7216 472 |
|
|
Peru 0.5000 0.3016 0.3762 189 |
|
|
Philippines 0.5217 0.1569 0.2412 153 |
|
|
Poland 0.5122 0.6275 0.5640 604 |
|
|
Portugal 0.2000 0.0059 0.0115 169 |
|
|
Romania 0.4167 0.3512 0.3812 242 |
|
|
Russia 0.6232 0.7946 0.6985 1232 |
|
|
Singapore 0.7339 0.9211 0.8169 494 |
|
|
Slovakia 0.0000 0.0000 0.0000 75 |
|
|
South Africa 0.7535 0.7717 0.7625 828 |
|
|
South Korea 0.5478 0.5059 0.5260 170 |
|
|
Spain 0.4589 0.5492 0.5000 752 |
|
|
Sweden 0.5311 0.3701 0.4362 508 |
|
|
Switzerland 1.0000 0.0165 0.0325 121 |
|
|
Taiwan 0.6029 0.4293 0.5015 382 |
|
|
Thailand 0.5309 0.7939 0.6363 660 |
|
|
Turkey 0.4872 0.2032 0.2868 187 |
|
|
Ukraine 0.0000 0.0000 0.0000 79 |
|
|
United Kingdom 0.6792 0.8746 0.7646 1738 |
|
|
|
|
|
accuracy 0.6485 25160 |
|
|
macro avg 0.4944 0.3713 0.3836 25160 |
|
|
weighted avg 0.6147 0.6485 0.6106 25160 |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
## **Label Classes** |
|
|
|
|
|
The model classifies an image into one of the following 55 countries: |
|
|
|
|
|
``` |
|
|
0: Argentina 1: Australia 2: Austria 3: Bangladesh |
|
|
4: Belgium 5: Bolivia 6: Botswana 7: Brazil |
|
|
8: Bulgaria 9: Cambodia 10: Canada 11: Chile |
|
|
12: Colombia 13: Croatia 14: Czechia 15: Denmark |
|
|
16: Finland 17: France 18: Germany 19: Ghana |
|
|
20: Greece 21: Hungary 22: India 23: Indonesia |
|
|
24: Ireland 25: Israel 26: Italy 27: Japan |
|
|
28: Kenya 29: Latvia 30: Lithuania 31: Malaysia |
|
|
32: Mexico 33: Netherlands 34: New Zealand 35: Nigeria |
|
|
36: Norway 37: Peru 38: Philippines 39: Poland |
|
|
40: Portugal 41: Romania 42: Russia 43: Singapore |
|
|
44: Slovakia 45: South Africa 46: South Korea 47: Spain |
|
|
48: Sweden 49: Switzerland 50: Taiwan 51: Thailand |
|
|
52: Turkey 53: Ukraine 54: United Kingdom |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
## **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/GeoGuessr-55" |
|
|
model = SiglipForImageClassification.from_pretrained(model_name) |
|
|
processor = AutoImageProcessor.from_pretrained(model_name) |
|
|
|
|
|
# ID to label mapping |
|
|
id2label = { |
|
|
"0": "Argentina", "1": "Australia", "2": "Austria", "3": "Bangladesh", "4": "Belgium", |
|
|
"5": "Bolivia", "6": "Botswana", "7": "Brazil", "8": "Bulgaria", "9": "Cambodia", |
|
|
"10": "Canada", "11": "Chile", "12": "Colombia", "13": "Croatia", "14": "Czechia", |
|
|
"15": "Denmark", "16": "Finland", "17": "France", "18": "Germany", "19": "Ghana", |
|
|
"20": "Greece", "21": "Hungary", "22": "India", "23": "Indonesia", "24": "Ireland", |
|
|
"25": "Israel", "26": "Italy", "27": "Japan", "28": "Kenya", "29": "Latvia", |
|
|
"30": "Lithuania", "31": "Malaysia", "32": "Mexico", "33": "Netherlands", |
|
|
"34": "New Zealand", "35": "Nigeria", "36": "Norway", "37": "Peru", "38": "Philippines", |
|
|
"39": "Poland", "40": "Portugal", "41": "Romania", "42": "Russia", "43": "Singapore", |
|
|
"44": "Slovakia", "45": "South Africa", "46": "South Korea", "47": "Spain", "48": "Sweden", |
|
|
"49": "Switzerland", "50": "Taiwan", "51": "Thailand", "52": "Turkey", "53": "Ukraine", |
|
|
"54": "United Kingdom" |
|
|
} |
|
|
|
|
|
def classify_country(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() |
|
|
|
|
|
return {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))} |
|
|
|
|
|
# Launch Gradio demo |
|
|
iface = gr.Interface( |
|
|
fn=classify_country, |
|
|
inputs=gr.Image(type="numpy"), |
|
|
outputs=gr.Label(num_top_classes=5, label="Top Predicted Countries"), |
|
|
title="GeoGuessr-55", |
|
|
description="Upload an image to predict which country it's from. The model uses SigLIP2 to classify among 55 countries." |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
iface.launch() |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
## **Applications** |
|
|
|
|
|
* **GeoGuessr-style games and challenges** |
|
|
* **Geographical tagging of unlabeled datasets** |
|
|
* **Tourism photo origin prediction** |
|
|
* **Education and training for human geographers or ML enthusiasts** |