Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,27 @@
|
|
| 1 |
---
|
| 2 |
datasets:
|
| 3 |
- marcelomoreno26/geoguessr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
```py
|
| 7 |
Classification Report:
|
| 8 |
precision recall f1-score support
|
|
@@ -66,4 +85,99 @@ United Kingdom 0.6792 0.8746 0.7646 1738
|
|
| 66 |
accuracy 0.6485 25160
|
| 67 |
macro avg 0.4944 0.3713 0.3836 25160
|
| 68 |
weighted avg 0.6147 0.6485 0.6106 25160
|
| 69 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
datasets:
|
| 3 |
- marcelomoreno26/geoguessr
|
| 4 |
+
license: apache-2.0
|
| 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 |
+
- GeoGuessr
|
| 13 |
+
- '55'
|
| 14 |
+
- Loaction
|
| 15 |
+
- RSI
|
| 16 |
+
- Remote Sensing Instruments
|
| 17 |
---
|
| 18 |
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
# **GeoGuessr-55**
|
| 22 |
+
|
| 23 |
+
> **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.
|
| 24 |
+
|
| 25 |
```py
|
| 26 |
Classification Report:
|
| 27 |
precision recall f1-score support
|
|
|
|
| 85 |
accuracy 0.6485 25160
|
| 86 |
macro avg 0.4944 0.3713 0.3836 25160
|
| 87 |
weighted avg 0.6147 0.6485 0.6106 25160
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## **Label Classes**
|
| 93 |
+
|
| 94 |
+
The model classifies an image into one of the following 55 countries:
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
0: Argentina 1: Australia 2: Austria 3: Bangladesh
|
| 98 |
+
4: Belgium 5: Bolivia 6: Botswana 7: Brazil
|
| 99 |
+
8: Bulgaria 9: Cambodia 10: Canada 11: Chile
|
| 100 |
+
12: Colombia 13: Croatia 14: Czechia 15: Denmark
|
| 101 |
+
16: Finland 17: France 18: Germany 19: Ghana
|
| 102 |
+
20: Greece 21: Hungary 22: India 23: Indonesia
|
| 103 |
+
24: Ireland 25: Israel 26: Italy 27: Japan
|
| 104 |
+
28: Kenya 29: Latvia 30: Lithuania 31: Malaysia
|
| 105 |
+
32: Mexico 33: Netherlands 34: New Zealand 35: Nigeria
|
| 106 |
+
36: Norway 37: Peru 38: Philippines 39: Poland
|
| 107 |
+
40: Portugal 41: Romania 42: Russia 43: Singapore
|
| 108 |
+
44: Slovakia 45: South Africa 46: South Korea 47: Spain
|
| 109 |
+
48: Sweden 49: Switzerland 50: Taiwan 51: Thailand
|
| 110 |
+
52: Turkey 53: Ukraine 54: United Kingdom
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## **Installation**
|
| 116 |
+
|
| 117 |
+
```bash
|
| 118 |
+
pip install transformers torch pillow gradio
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
## **Example Inference Code**
|
| 124 |
+
|
| 125 |
+
```python
|
| 126 |
+
import gradio as gr
|
| 127 |
+
from transformers import AutoImageProcessor, SiglipForImageClassification
|
| 128 |
+
from PIL import Image
|
| 129 |
+
import torch
|
| 130 |
+
|
| 131 |
+
# Load model and processor
|
| 132 |
+
model_name = "prithivMLmods/GeoGuessr-55"
|
| 133 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 134 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 135 |
+
|
| 136 |
+
# ID to label mapping
|
| 137 |
+
id2label = {
|
| 138 |
+
"0": "Argentina", "1": "Australia", "2": "Austria", "3": "Bangladesh", "4": "Belgium",
|
| 139 |
+
"5": "Bolivia", "6": "Botswana", "7": "Brazil", "8": "Bulgaria", "9": "Cambodia",
|
| 140 |
+
"10": "Canada", "11": "Chile", "12": "Colombia", "13": "Croatia", "14": "Czechia",
|
| 141 |
+
"15": "Denmark", "16": "Finland", "17": "France", "18": "Germany", "19": "Ghana",
|
| 142 |
+
"20": "Greece", "21": "Hungary", "22": "India", "23": "Indonesia", "24": "Ireland",
|
| 143 |
+
"25": "Israel", "26": "Italy", "27": "Japan", "28": "Kenya", "29": "Latvia",
|
| 144 |
+
"30": "Lithuania", "31": "Malaysia", "32": "Mexico", "33": "Netherlands",
|
| 145 |
+
"34": "New Zealand", "35": "Nigeria", "36": "Norway", "37": "Peru", "38": "Philippines",
|
| 146 |
+
"39": "Poland", "40": "Portugal", "41": "Romania", "42": "Russia", "43": "Singapore",
|
| 147 |
+
"44": "Slovakia", "45": "South Africa", "46": "South Korea", "47": "Spain", "48": "Sweden",
|
| 148 |
+
"49": "Switzerland", "50": "Taiwan", "51": "Thailand", "52": "Turkey", "53": "Ukraine",
|
| 149 |
+
"54": "United Kingdom"
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
def classify_country(image):
|
| 153 |
+
image = Image.fromarray(image).convert("RGB")
|
| 154 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 155 |
+
|
| 156 |
+
with torch.no_grad():
|
| 157 |
+
outputs = model(**inputs)
|
| 158 |
+
logits = outputs.logits
|
| 159 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 160 |
+
|
| 161 |
+
return {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
|
| 162 |
+
|
| 163 |
+
# Launch Gradio demo
|
| 164 |
+
iface = gr.Interface(
|
| 165 |
+
fn=classify_country,
|
| 166 |
+
inputs=gr.Image(type="numpy"),
|
| 167 |
+
outputs=gr.Label(num_top_classes=5, label="Top Predicted Countries"),
|
| 168 |
+
title="GeoGuessr-55",
|
| 169 |
+
description="Upload an image to predict which country it's from. The model uses SigLIP2 to classify among 55 countries."
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
if __name__ == "__main__":
|
| 173 |
+
iface.launch()
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
## **Applications**
|
| 179 |
+
|
| 180 |
+
* **GeoGuessr-style games and challenges**
|
| 181 |
+
* **Geographical tagging of unlabeled datasets**
|
| 182 |
+
* **Tourism photo origin prediction**
|
| 183 |
+
* **Education and training for human geographers or ML enthusiasts**
|