GT-Loc: Unifying When and Where in Images Through a Joint Embedding Space

David G. Shatwell, Ishan Rajendrakumar Dave, Sirnam Swetha, Mubarak Shah

TL;DR

GT-Loc introduces a unified retrieval-based framework that simultaneously predicts when (hour and month) and where (GPS coordinates) an image was captured using only visual information. By mapping images, time, and location into a shared multimodal embedding space and optimizing them with a novel cyclical temporal metric loss, it outperforms existing time-prediction models while remaining highly competitive in global geo-localization.

What Problem Does This Paper Address?

Pinpointing the exact time and location an image was taken is a foundational challenge for digital forensics, ecological monitoring, and image retrieval. However, visual cues like scene brightness, shadow angles, and seasonal foliage are deeply entangled—the sun's position at 4:00 PM in London in December looks vastly different from 4:00 PM in Miami, or even 4:00 PM in London in July.

Existing methods typically decouple these tasks, either focusing solely on one modality or requiring ground-truth location metadata as an input to predict time accurately. Furthermore, standard contrastive learning frameworks (like CLIP) struggle with temporal data. In contrastive learning, other instances in a batch are treated as "hard negatives." But for time prediction, temporal neighbors (e.g., 3:00 PM vs. 3:15 PM) look nearly identical. Forcing the model to treat adjacent time points as negatives undermines effective feature alignment.

Methods

Figure 2. Overview of GT-Loc: GT-Loc uses an image encoder V(·), location encoder L (·) and time encoder T (·) to generate a set of image Vi, location Li and time Ti embeddings. Leveraging the CLIP [24] pretrained ViT-L/14 as image encoder, we aim to align its image embedding to both location and time embeddings. The image-location alignment is learned through a regular CLIP-like loss [37] and the image-time alignment is learned through our proposed Temporal Metric Learning.

GT-Loc addresses these challenges using a triple-encoder architecture that projects images, locations, and times into a single continuous feature space:

  1. Image Encoder ($\mathcal{V}$): Utilizes a frozen, pretrained CLIP ViT-L/14 backbone paired with a trainable multi-layer perceptron (MLP) projection layer.
  2. Location Encoder ($\mathcal{L}$): Adapts the GeoCLIP architecture, converting latitude and longitude via an Equal Earth Projection (EEP), mapping them through multi-scale Random Fourier Features (RFF), and passing them to an MLP.
  3. Time Encoder ($\mathcal{T}$): Converts Unix timestamps into normalized, cyclic month-hour pairs to capture both Time-of-Year (ToY) and Time-of-Day (ToD). Like the location encoder, it processes these continuous values using RFFs and MLPs.

Temporal Metric Learning (TML)

To solve the "hard negative" issue for temporal data, the authors introduce a novel Temporal Metric Learning (TML) loss function. Instead of binary positive/negative assignments, TML provides soft targets proportional to the actual time difference between samples. Because hours and months are periodic, the distance is calculated over a cyclical toroidal manifold rather than standard Euclidean ($\ell_2$) space, preventing the model from overestimating the distance between points like 11:59 PM and 12:01 AM.

Illustration of the TML loss distribution mapping and the toroidal distance metric vs standard Euclidean distance.

Datasets

  • Training: The model is jointly trained on the MediaEval Placing Tasks 2016 (MP-16) dataset (4.72 million Flickr images with GPS coordinates) and the Cross-View Time (CVT) dataset (~304k geotagged images from smartphones and outdoor webcams). Night-time and indoor images are filtered out using solar position algorithms and scene classifiers to ensure consistent temporal cues.
  • Evaluation:
  • Time Prediction: Evaluated zero-shot on unseen cameras from the SkyFinder dataset.
  • Geo-localization: Evaluated on the standard standard Im2GPS3k and GWS15k benchmarks.

Key Insights and Ideas

  • The Power of Joint Optimization: Training the model to learn time and location together enriches the learned representations for both tasks. Spatial context naturally informs temporal cues, allowing GT-Loc to outperform models that are given the ground-truth location explicitly at inference time.
  • Soft Targets for Smooth Modalities: Visual features change smoothly over time. Replacing hard contrastive negatives with soft targets derived from toroidal distances allows the model to learn smooth representation gradients.
  • Compositional and Text-Based Retrieval: Because all three modalities share a single embedding space, the model inherently supports compositional queries. For example, a user can average a specific time and location embedding to retrieve matching images, or use natural language queries (e.g., "Warm summer evening in Oslo") to generate accurate spatio-temporal distributions without explicit metadata.

Key Results

  • Time Prediction: On the SkyFinder benchmark, GT-Loc achieved a Time Prediction Score (TPS) of 77.00, reducing the mean absolute error to 1.40 months and 2.72 hours. This significantly outperformed baselines like Salem et al. (TPS 75.02) and Zhai et al. (TPS 73.20), even though those baselines utilized ground-truth geo-location as an input.
  • Geo-localization: Despite not being a single-task expert model, GT-Loc achieved a 14.41% accuracy within a 1 km radius on Im2GPS3k, outperforming specialized models like GeoCLIP (14.11%) and PIGEOTTO (11.3%).
  • Robustness: The framework proved highly resilient to data constraints, maintaining a stable TPS of 72.07 even when the training data was cut down to just 5%, and showing strong tolerance against simulated label noise.

Limitations and Future Work

  • Population Density Bias: Like most web-scraped models, geo-localization performance degrades significantly in sparsely populated areas ($<100 \text{ pop/m}^2$) due to data scarcity.
  • Weather Sensitivity: Extreme weather conditions, such as heavy fog, obscure critical visual cues (like shadows and horizon lines), leading to higher temporal prediction errors.
  • Chronological Scope: The model currently discards the year information, focusing entirely on cyclical daily and seasonal patterns. Extending the architecture to handle long-term chronological tracking (predicting the exact year) remains an open direction for future work.

Summary updated

BibTeX
@inproceedings{shatwell2025gt,
  author = {David G. Shatwell and Ishan Rajendrakumar Dave and Sirnam Swetha and Mubarak Shah},
  title = {{GT-Loc: Unifying When and Where in Images Through a Joint Embedding Space}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
  url = {https://openreview.net/forum?id=fB3Z7marnc},
}
Figure