Which country is this picture from? New data and methods for DNN-based country recognition

Omran Alamayreh, Giovanna Maria Dimitri, Jun Wang, Benedetta Tondi, Mauro Barni · DOI

Abstract

Recognizing the country where a picture has been taken has many potential applications, such as identification of fake news and prevention of disinformation campaigns. Previous works focused on the estimation of the geo-coordinates where a picture has been taken. Yet, recognizing in which country an image was taken could be more critical, from a semantic and forensic point of view, than estimating its spatial coordinates. In the above framework, this paper provides two contributions. First, we introduce the VIPPGeo dataset, containing 3.8 million geo-tagged images. Secondly, we used the dataset to train a model casting the country recognition problem as a classification problem. The experiments show that our model provides better results than the current state of the art. Notably, we found that asking the network to identify the country provides better results than estimating the geo-coordinates and then tracing them back to the country where the picture was taken.

Introduction: Shifting the Geo-Localization Paradigm

Most image geo-localization research aims for "pinpoint" accuracy, attempting to estimate the exact latitude and longitude of a scene. However, this is an incredibly difficult task. For many practical applications—such as identifying the source of fake news or verifying a journalist's location—knowing the country is often more important and semantically relevant than the exact street corner.

Researchers from the University of Siena argue that "thinking in countries" is more effective for AI. Countries are human constructs that share distinct architectural styles, languages, and cultural markers. Previous models often struggled because they were trained on noisy data or because they tried to minimize spatial distance error, which can lead to "jumping" across a border into the wrong country just to save a few miles of error. By shifting the focus to direct country classification, the authors outperformed existing state-of-the-art models.

Methodology: Country Recognition as Classification

The authors treated country recognition as a multi-class classification problem rather than a regression problem. They utilized a ResNet-101 backbone, pre-trained on ImageNet, to extract features.

The "5-Crop" Strategy

To process high-resolution images without losing detail or distorting aspect ratios, the researchers implemented a specific inference pipeline. Images are resized so the smaller dimension is 256 pixels, and then five 224x224 crops (four corners and one center) are extracted. The final prediction is the average of the scores from these five crops.

The 5-crop strategy and ResNet-101 architecture used for country classification.

Training and Filtering

To handle class imbalance (where some countries have millions of photos and others only hundreds), a weighted cross-entropy loss function was used, weighting the loss by the inverse square root of the class frequency.

Furthermore, the team employed semantic filtering using a secondary AI (Places365-CNN) to keep only "urban outdoor" scenes. They removed images dominated by faces, old grey-level photos, and non-relevant subjects like airplanes or ships that lack country-specific architectural cues. This forced the model to focus on human-made features—the very things that vary most distinctly between nations.

The VIPPGeo Dataset

The paper introduces VIPPGeo, a major new benchmark consisting of 3.8 million geo-tagged images crawled from Flickr, Mapillary, and Unsplash. While it covers 243 countries, the authors grouped these into 61 country classes based on geographic proximity and data volume to ensure training stability. The model was also validated on standard benchmarks like Im2GPS and Im2GPS-3k.

Key Insights and Results

The most significant finding is that direct classification yields better results than coordinate estimation followed by a lookup. The network learns to associate specific visual "dialects"—like window shapes or street signs—directly with a country label.

Model Plausibility and "Frankenstein" Images

To verify that the model was identifying the correct semantic features, the authors created composite "Frankenstein" images (e.g., pasting a Japanese monument into an Italian street). The model's top predictions correctly identified both contributing countries, suggesting it has learned to recognize specific landmarks and architectural styles.

Testing model plausibility using composite 'Frankenstein' images.

Performance Metrics

The proposed method showed a clear advantage over the previous state-of-the-art (the ISN model):

  • VIPPGeo Accuracy: Achieved a Top-1 accuracy of 0.66, significantly outperforming the ISN model's 0.41.
  • External Validation: On the Im2GPS dataset, the model hit a Top-1 accuracy of 0.80 and a Top-5 accuracy of 0.97.
  • Balanced Accuracy: The frequency-weighting strategy maintained a balanced accuracy of 0.60 across all 61 classes, preventing bias toward data-heavy countries.

Limitations and Future Outlook

While successful, the approach has limitations. The grouping of 243 countries into 61 classes was a manual process that could be refined. Additionally, the focus on urban scenes means the model may struggle with rural landscapes. Future work could move toward finer granularity, aiming to recognize specific cities or towns.

Summary updated

Abstract

Recognizing the country where a picture has been taken has many potential applications, such as identification of fake news and prevention of disinformation campaigns. Previous works focused on the estimation of the geo-coordinates where a picture has been taken. Yet, recognizing in which country an image was taken could be more critical, from a semantic and forensic point of view, than estimating its spatial coordinates. In the above framework, this paper provides two contributions. First, we introduce the VIPPGeo dataset, containing 3.8 million geo-tagged images. Secondly, we used the dataset to train a model casting the country recognition problem as a classification problem. The experiments show that our model provides better results than the current state of the art. Notably, we found that asking the network to identify the country provides better results than estimating the geo-coordinates and then tracing them back to the country where the picture was taken.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Im2gps (102 images)Proposed method (ResNet-101)Top-1 accuracy0.80split: test · backbone=ResNet-101
Source quote
L140: 0.80 │ 0.91 │ 0.97 │ 0.98 │ 0.80 │ 0.67 │ 0.83 │ 0.88 │ 0.94 │ 0.56 │ 0.66 │ 0.81 │ 0.87 │ 0.93 │ 0.60
Im2gps3k (1001 images)Proposed method (ResNet-101)Top-1 accuracy0.67+0.01 vs baselinesplit: test · backbone=ResNet-101
Source quote
L140: 0.80 │ 0.91 │ 0.97 │ 0.98 │ 0.80 │ 0.67 │ 0.83 │ 0.88 │ 0.94 │ 0.56 │ 0.66 │ 0.81 │ 0.87 │ 0.93 │ 0.60
VIPPGeo test set (76269 images)Proposed method (ResNet-101)Top-1 accuracy0.66+0.25 vs baselinesplit: test · backbone=ResNet-101
Source quote
L140: 0.80 │ 0.91 │ 0.97 │ 0.98 │ 0.80 │ 0.67 │ 0.83 │ 0.88 │ 0.94 │ 0.56 │ 0.66 │ 0.81 │ 0.87 │ 0.93 │ 0.60
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
Im2gps (102 images)ISN state-of-the-art baselineTop-1 accuracy0.80Country classification on the same filtered urban-view subset (102 images). ISN is the …
Source quote
L132: ISN state-of-the-art~\cite{muller2018geolocation} │ 0.80 │ 0.88 │ 0.88 │ 0.91 │ 0.75 │ 0.66 │ 0.76 │ 0.80 │ 0.85 │ 0.51 │ 0.41 │ 0.52 │ 0.57 │ 0.65 │ 0.31
Im2gps3k (1001 images)ISN state-of-the-art baselineTop-1 accuracy0.66Country classification on the same filtered urban-view subset (1,001 images). ISN is th…
Source quote
L132: ISN state-of-the-art~\cite{muller2018geolocation} │ 0.80 │ 0.88 │ 0.88 │ 0.91 │ 0.75 │ 0.66 │ 0.76 │ 0.80 │ 0.85 │ 0.51 │ 0.41 │ 0.52 │ 0.57 │ 0.65 │ 0.31
VIPPGeo test set (76269 images)ISN state-of-the-art baselineTop-1 accuracy0.41split: test
Source quote
L132: ISN state-of-the-art~\cite{muller2018geolocation} │ 0.80 │ 0.88 │ 0.88 │ 0.91 │ 0.75 │ 0.66 │ 0.76 │ 0.80 │ 0.85 │ 0.51 │ 0.41 │ 0.52 │ 0.57 │ 0.65 │ 0.31
BibTeX
@misc{alamayreh2022which,
  author = {Omran Alamayreh and Giovanna Maria Dimitri and Jun Wang and Benedetta Tondi and Mauro Barni},
  title = {{Which country is this picture from? New data and methods for DNN-based country recognition}},
  year = {2022},
  eprint = {2209.02429},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.02429},
}
Figure