---
title: 'VG-SSL: Geo-localization with Self-supervision'
url: https://www.emergentmind.com/topics/vgg-ssl
type: topic
---

# VG-SSL: Geo-localization with Self-supervision

VG-SSL, whose correct name is **Visual Geo-localization with Self-supervised Learning** rather than “VGG-SSL,” is a unified self-supervised framework for visual geo-localization (VG) that benchmarks multiple SSL paradigms within a retrieval-oriented training pipeline [2308.00090]. In this setting, VG, also known as Visual Place Recognition, is the task of estimating the geolocation of a query image by matching it to a georeferenced database via image retrieval. The framework was introduced to address two linked objectives: eliminating the need for Hard Negative Mining (HNM) while maintaining or surpassing its performance, and providing a standardized, scalable benchmark for studying how diverse SSL objectives behave on VG across multiple datasets. Its central mechanism is a geo-related pair construction strategy, GeoPair, which supplies informative positive pairs from geographic proximity and includes negatives from the database without HNM [2308.00090].

## 1. Problem setting and conceptual scope

Visual geo-localization is critical for robotics and autonomous vehicles because it enables robust localization under changes in viewpoint, illumination, weather, and seasonal conditions [2308.00090]. Contemporary VG systems typically rely on learned global descriptors produced by a feature extractor and an aggregation module such as NetVLAD, followed by retrieval over a large geo-referenced image database. In supervised VG pipelines, training commonly uses triplet losses with HNM, but HNM incurs significant computational and memory costs on large-scale datasets [2308.00090].

VG-SSL was formulated as a direct response to this bottleneck. Rather than mining hard negatives in feature space, it integrates SSL objectives directly into the VG pipeline and replaces mining with a geographically structured sampling mechanism. The framework instantiates and systematically benchmarks six SSL methods for VG: SimCLR, MoCov2, BYOL, SimSiam, Barlow Twins, and VICReg [2308.00090]. The paper also reports the standard Triplet Margin Loss as a supervised VG baseline.

The paper characterizes the framework as the first benchmarking study of SSL in VG and emphasizes that the benchmark is intended both as a methodological unification and as a computationally lighter alternative to HNM-based training [2308.00090]. A plausible implication is that VG-SSL should be understood not merely as a new loss or model, but as an experimental protocol for comparing SSL objectives under a common retrieval architecture and geo-aware sampling regime.

## 2. GeoPair and the elimination of hard negative mining

The key design element in VG-SSL is **GeoPair**, a geo-related pair construction and sampling mechanism defined from image geolocations. Each image $I$ is associated with a geolocation $g$ given by latitude and longitude, and geographic distance is denoted by $d(g_i, g_j)$ [2308.00090]. Positives and negatives are defined by distance thresholds:

- Positive radius: $r_{pos} = 10 \text{ m}$, with
  $$
  P(q) = \{k \in \text{database} : d(g_q, g_k) \le r_{pos}\}.
  $$
- Negative radius: $r_{neg} = 25 \text{ m}$, with
  $$
  N(q) = \{k \in \text{database} : d(g_q, g_k) \ge r_{neg}\}.
  $$

For each epoch, the framework samples $m_q$ query images $\{I_q\}$ and, for each query, a positive $I_{k^p} \in P(q)$ uniformly. It then samples $m_k^n = \eta m_q$ negatives from a global negative pool, where $\eta \ge 0$ is the **Database Negative Ratio**. Two types of pairs are constructed: geo-positive pairs $(I_q, I_{k^p})$ and identical “database negative” pairs $(I_{k^n}, I_{k^n})$ [2308.00090]. The resulting pair set is

$$
S(\eta) = \{(I_q, I_{k^p})\}_{b=1}^{m_q} \cup \{(I_{k^n}, I_{k^n})\}_{c=1}^{\eta m_q}.
$$

Sampling is uniform within each set; no distance weighting $w(d)$ is applied, and no HNM is used [2308.00090].

This construction serves two functions. First, it gives SSL objectives a geo-semantic notion of positive correspondence derived from geographic proximity rather than synthetic augmentation alone. Second, it ensures that many database images that would otherwise be unused due to missing corresponding queries still participate in training via identical database negative pairs [2308.00090]. Importantly, negatives are never selected by nearest-neighbor mining in feature space.

The paper gives an explicit complexity comparison. With full-database HNM, extraction is $O(\#I_q + \#I_k)$ and matching is $O(\#I_q \cdot \#I_k)$; even partial HNM requires $O(\#I_q \cdot (\#I_{k^p} + \#I_{k^n}))$. By contrast, VG-SSL uses only positives and identical database negatives, with extraction cost $O(\#I_q + \#I_{k^p})$ and matching cost $O(\#I_q \cdot \#I_{k^p})$ [2308.00090]. This is the principal efficiency argument for the framework.

## 3. Loss functions and objective-specific behavior

VG-SSL applies SSL objectives to embeddings produced by a feature extractor $F = F_p \circ F_g \circ F_l$, where $F_l$ is a local backbone, $F_g$ a global aggregation module, and $F_p$ a projection head [2308.00090]. For a query, positive, and sampled database negative, the framework computes
$$
q = F(I_q), \quad k^p = F(I_{k^p}), \quad k^n = F(I_{k^n}).
$$
Depending on the objective, embeddings may be $\ell_2$-normalized, denoted with tildes.

The supervised reference is the Triplet Margin Loss,
$$
L_T = \frac{1}{N} \sum_{b=1}^N \max\{ ||\tilde z q_b - \tilde z k^p_b||_2 - ||\tilde z q_b - \tilde z k^n_b||_2 + d_1, 0 \},
$$
which requires HNM to select hard $k^n$ [2308.00090]. It functions as the baseline against which the SSL variants are compared.

For SimCLR and MoCov2, VG-SSL uses the InfoNCE objective,
$$
L_{InfoNCE} = -\frac{1}{N} \sum_{b=1}^N \log \frac{\exp(\tilde z q_b \cdot \tilde z k^p_b / \tau)}{\sum_{i=1, i \ne b}^N \exp(\tilde z q_b \cdot \tilde z k^p_i / \tau)}.
$$
A symmetric form averages the loss after swapping the two views. In VG-SSL, positives are geo-related pairs, while negatives arise implicitly from other positives in the batch and explicitly through the presence of identical database negative pairs. MoCov2 additionally uses a momentum target encoder to produce stable keys [2308.00090].

For BYOL and SimSiam, the framework uses an embedding prediction loss,
$$
L_{EmbPred} = \frac{1}{N} \sum_{b=1}^N \left[ 2 - 2 \langle \tilde z p(\tilde z q_b), stopgrad(\tilde z k^p_b) \rangle \right].
$$
Again, a symmetric version can be formed by swapping inputs. BYOL uses a momentum target encoder, whereas SimSiam shares weights and relies on stop-grad and batch norm to avoid collapse [2308.00090]. The paper notes a specific failure mode in VG-SSL: identical negative pairs can induce collapse for self-distillation methods when $\eta$ is large, so $\eta$ must be tuned carefully.

For Barlow Twins, the framework computes the $D \times D$ cross-correlation matrix
$$
C_{ij} = \frac{\sum_{b=1}^N q_{b,i} k^p_{b,j}}{\sqrt{\sum_{b=1}^N q_{b,i}^2}\sqrt{\sum_{b=1}^N (k^p_{b,j})^2}},
$$
with loss
$$
L_{BT} = \sum_{i=1}^D (1 - C_{ii})^2 + \lambda \sum_{i=1}^D \sum_{j=1, j \ne i}^D C_{ij}.
$$
For VICReg, the framework uses
$$
L_{VICReg} =
\frac{\lambda_1}{N D} \sum_{b=1}^N \sum_{i=1}^D ||q_{b,i} - k^p_{b,i}||_2^2
+ \frac{\lambda_2}{D} \sum_{i=1}^D \left[\max\{d_2 - std_i(q), 0\} + \max\{d_2 - std_i(k^p), 0\}\right]
+ \frac{\lambda_3}{D} \sum_{i=1}^D \sum_{j=1, j \ne i}^D [cov_{ij}^2(q) + cov_{ij}^2(k^p)].
$$
For both BT and VICReg, VG-SSL avoids $\ell_2$ normalization because the objectives operate on batchwise correlation or covariance [2308.00090].

A central empirical distinction reported by the paper is that contrastive methods and information-maximization methods tolerate $\eta = 1$ well, whereas BYOL and SimSiam are sensitive to large $\eta$ and may collapse [2308.00090]. This suggests that GeoPair does not interact uniformly with all SSL paradigms: its identical database negative pairs are benign for some objectives and destabilizing for others.

## 4. Architecture, implementation, datasets, and evaluation

The feature extractor in VG-SSL consists of a local feature extractor $F_l$, a global aggregation module $F_g$, and a projection head $F_p$ [2308.00090]. The local feature extractor is an ImageNet-pretrained ResNet-50, with features taken from `conv4_x`; the global aggregation module is NetVLAD; and the projection head is a fully connected MLP with $L$ layers, where hidden dimensionality equals output dimension $D$ [2308.00090].

The framework evaluates embedding dimensionalities $D = 1024, 2048, 4096$. BT and VICReg benefit markedly from larger $D$, whereas SimCLR, MoCov2, and BYOL are less sensitive and remain competitive at $D = 1024$–$2048$ [2308.00090]. With respect to head depth, linear projection ($L = 1$) works best for SimCLR and MoCov2, while non-linear projection ($L = 2$) is best for BYOL, SimSiam, BT, and VICReg. The paper further reports that with $L = 1$, SimSiam collapses and BYOL, BT, and VICReg degrade, consistent with their original designs [2308.00090].

Training and evaluation use images resized to $480 \times 640$; Tokyo 24/7 queries are resized to the same resolution for consistency [2308.00090]. Default batch size is 64 for most experiments and ablations, while optimal settings use batch size 256 for SimCLR, BT, and VICReg, and 64 for MoCov2, BYOL, and SimSiam. The optimizer is Adam, with learning rate $1e{-5}$ for SimCLR and MoCov2, $1e{-4}$ for BYOL, SimSiam, BT, and VICReg, and weight decay $1e{-6}$. Approximately 24 hours of training yields approximately 250 epochs, with 5000 queries per epoch, on one NVIDIA A100 80GB GPU. No HNM is used at any time [2308.00090].

The benchmark uses five public VG datasets: Pitts30k, MSLS, Tokyo 24/7, Eynsham, and St. Lucia [2308.00090]. Pitts30k, MSLS, Eynsham, and St. Lucia are car-mounted datasets; Tokyo 24/7 is cross-domain, with a database from Google Street View and smartphone queries. MSLS is used for training, and its validation set is used as test because the test ground truth is private [2308.00090].

Evaluation uses Recall@N, with the paper emphasizing Recall@1 as the main metric. Retrieval is performed with KNN in the learned embedding space, and a query counts as correct when at least one of the top-$N$ retrieved database images lies within an evaluation threshold $r_{eval} = 25 \text{ m}$ of the ground-truth location:
$$
R@N = \frac{1}{|Q|} \sum_{q \in Q} 1\left[ \min_{j \in top\text{-}N(q)} d(g_q, g_j) \le r_{eval} \right].
$$
At inference, the projected embeddings after $F_p$ are used directly without further fine-tuning [2308.00090].

## 5. Quantitative results and ablation findings

The main quantitative results show that several SSL methods match or approach supervised triplet baselines while avoiding HNM [2308.00090]. At $D = 4096$, **BT-FC-2-4096-1** with batch 256 achieves Recall@1 values of 76.8 on Pitts30k, 77.9 on MSLS, 43.8 on Tokyo 24/7, 84.2 on Eynsham, and 91.3 on St. Lucia. Under the same dimensionality, **VICReg-FC-2-4096-1** with batch 256 achieves 72.0, 74.2, 35.7, 81.7, and 86.7, respectively. The reproduced **Triplet-PCA-4096** baseline attains 76.7 on Pitts30k, 77.1 on MSLS, 43.3 on Tokyo 24/7, 85.2 on Eynsham, and 94.7 on St. Lucia [2308.00090].

At $D = 2048$, **SimCLR-FC-1-2048-1** with batch 256 achieves 75.2 on Pitts30k, 76.6 on MSLS, 44.3 on Tokyo 24/7, 85.6 on Eynsham, and 91.2 on St. Lucia. **MoCov2-FC-1-2048-1** with batch 64 achieves 76.2, 74.2, 47.0, 84.8, and 89.1. **BYOL-FC-2-2048-0.25** with batch 64 achieves 76.0, 75.7, 43.9, 84.3, and 90.5. **SimSiam-FC-2-2048-0.25** is reported as lower across the board, including 69.2 on Pitts30k. The reproduced **Triplet-PCA-2048** baseline reaches 75.8 on Pitts30k, 76.7 on MSLS, 40.7 on Tokyo 24/7, 84.8 on Eynsham, and 94.6 on St. Lucia [2308.00090].

The benchmark also reports a strong HNM-based reference, **Triplet (65535-dim, HNM; from benchmark)**, with Recall@1 values of 80.9 on Pitts30k, 76.9 on MSLS, 87.2 on Eynsham, and 93.8 on St. Lucia [2308.00090]. Against this backdrop, the paper’s main interpretation is that at $D = 4096$, BT is comparable to Triplet-PCA-4096 and close to Triplet with HNM on most datasets, without HNM. At $D = 2048$, SimCLR and MoCov2 are highly competitive and outperform Triplet-PCA-2048 on the cross-domain Tokyo 24/7 benchmark [2308.00090].

Tokyo 24/7 receives special attention because it evaluates hand-held queries against a car-mounted database. On this benchmark, MoCov2-FC-1-2048-1 reaches $R@1 = 47.0$ and SimCLR-FC-1-2048-1 reaches 44.3, both above the reproduced Triplet-PCA-2048 result of 40.7 under the unified resizing protocol [2308.00090]. The paper interprets this as evidence that SSL objectives emphasizing invariances and large-batch contrastive signal can produce descriptors with stronger cross-domain robustness.

The ablation studies isolate three main controls. First, for the Database Negative Ratio $\eta \in \{0, 0.25, 0.5, 1\}$, SimCLR, MoCov2, BT, and VICReg perform best at $\eta = 1$ on most datasets, whereas BYOL performs best at $\eta \in \{0.25, 0.5\}$ and SimSiam at $\eta \in \{0, 0.25\}$ [2308.00090]. Second, projection head depth matters: $L = 1$ is best for SimCLR and MoCov2, but $L = 2$ is best for BYOL, SimSiam, BT, and VICReg. Third, BT and VICReg benefit significantly from higher embedding dimension, especially 4096, whereas SimCLR, MoCov2, and BYOL are less sensitive and remain competitive at lower dimensions [2308.00090].

## 6. Practical use, interpretation, and limitations

VG-SSL is released as public code at `https://github.com/arplaboratory/VG_SSL`, built on PyTorch Lightning and including training pipelines for all integrated SSL variants, the feature extractor with NetVLAD aggregation, and evaluation scripts for Recall@N [2308.00090]. The paper’s practical defaults are explicit: use an ImageNet-pretrained ResNet-50 and NetVLAD; use image size $480 \times 640$; set $r_{pos} = 10 \text{ m}$ and $r_{neg} = 25 \text{ m}$; use $L = 1$ for SimCLR and MoCov2 and $L = 2$ for BYOL, SimSiam, BT, and VICReg; and prefer $\eta = 1$ for SimCLR, MoCov2, BT, and VICReg, $\eta \approx 0.25$–$0.5$ for BYOL, and $\eta \in \{0, 0.25\}$ for SimSiam [2308.00090].

For adaptation to new regions or datasets, the paper recommends keeping the $480 \times 640$ resizing and the same radii unless the dataset has substantially different GPS noise or density, increasing $D$ for BT and VICReg, and considering larger batches for SimCLR, BT, and VICReg if resources permit [2308.00090]. If the domain gap is large, as in hand-held versus car-mounted imagery, MoCov2 and SimCLR with $\eta = 1$ and $L = 1$ are reported to have strong cross-domain results [2308.00090].

The limitations are also method-specific. Resource constraints meant that the paper often used smaller batch sizes than are typical in SSL pretraining, and it notes that SimCLR, BT, and VICReg improve with larger batches [2308.00090]. BYOL and SimSiam can collapse when $\eta$ is large, BT and VICReg require larger $D$ and benefit from a two-layer projector, and the best SSL settings for VG differ from those often used in classification, notably the superiority of linear projection for SimCLR and MoCov2 in this retrieval setting [2308.00090]. The paper also did not exhaustively explore augmentation strategies or domain-specific pretext tasks, and it identifies extension to more SSL methods and analysis of augmentations and image size as future work.

A common misconception concerns the name itself: the framework is **VG-SSL**, not “VGG-SSL” [2308.00090]. More substantively, another possible misconception is that removing HNM necessarily weakens retrieval-oriented training. The reported results do not support that generalization. Instead, VG-SSL shows that geo-positive sampling combined with appropriately chosen SSL objectives can match or closely approach HNM-based supervised baselines on multiple datasets, while substantially reducing time and memory usage [2308.00090].

Source: https://www.emergentmind.com/topics/vgg-ssl