VPRTempo: A Fast Temporally Encoded Spiking Neural Network for Visual
  Place Recognition
Spiking Neural Networks (SNNs) are at the forefront of neuromorphic computing
thanks to their potential energy-efficiency, low latencies, and capacity for
continual learning. While these capabilities are well suited for robotics
tasks, SNNs have seen limited adaptation in this field thus far. This work
introduces a SNN for Visual Place Recognition (VPR) that is both trainable
within minutes and queryable in milliseconds, making it well suited for
deployment on compute-constrained robotic systems. Our proposed system,
VPRTempo, overcomes slow training and inference times using an abstracted SNN
that trades biological realism for efficiency. VPRTempo employs a temporal code
that determines the timing of a single spike based on a pixel's intensity, as
opposed to prior SNNs relying on rate coding that determined the number of
spikes; improving spike efficiency by over 100%. VPRTempo is trained using
Spike-Timing Dependent Plasticity and a supervised delta learning rule
enforcing that each output spiking neuron responds to just a single place. We
evaluate our system on the Nordland and Oxford RobotCar benchmark localization
datasets, which include up to 27k places. We found that VPRTempo's accuracy is
comparable to prior SNNs and the popular NetVLAD place recognition algorithm,
while being several orders of magnitude faster and suitable for real-time
deployment -- with inference speeds over 50 Hz on CPU. VPRTempo could be
integrated as a loop closure component for online SLAM on resource-constrained
systems such as space and underwater robots.
Adam D. Hines, Peter G. Stratton, Michael Milford, Tobias Fischer
# VPRTempo: A Fast Temporally Encoded Spiking Neural Network for Visual Place Recognition

###### Abstract

Spiking Neural Networks (SNNs) are at the forefront of neuromorphic computing thanks to their potential energy-efficiency, low latencies, and capacity for continual learning. While these capabilities are well suited for robotics tasks, SNNs have seen limited adaptation in this field thus far. This work introduces a SNN for Visual Place Recognition (VPR) that is both trainable within minutes and queryable in milliseconds, making it well suited for deployment on computer-constrained robotic systems. Our proposed system, VPRTempo, overcomes slow training and inference times using an abstracted SNN that trades biological realism for efficiency. VPRTempo employs a temporal code that determines the _timing_ of a _single_ spike based on a pixel's intensity, as opposed to prior SNNs relying on rate coding that determined the _number_ of spikes; improving spike efficiency by over 100%. VPRTempo is trained using Spike-Timing Dependent Plasticity and a supervised delta learning rule enforcing that each output spiking neuron responds to just a single place. We evaluate our system on the Nordland and Oxford RobotCar benchmark localization datasets, which include up to 27k places. We found that VPRTempo's accuracy is comparable to prior SNNs and the popular NetVLAD place recognition algorithm, while being several orders of magnitude faster and suitable for real-time deployment - with inference speeds over 50 Hz on CPU. VPRTempo could be integrated as a loop closure component for online SLAM on resource-constrained systems such as space and underwater robots.

## I Introduction

Spiking neural networks (SNNs) are computational tools that model how neurons in the brain send and receive information [64]. SNNs have attracted significant interest due to their energy efficiency, low-latency data processing, and deployability on neuromorphic hardware such as Intel's Loihi or SynSense's Speck [41, 42]. However, modeling the complexity of biological neurons limits the computational efficiency of SNNs, especially where resource-constrained systems with real-time applications are concerned. Using a SNN system that trades biological realism for overall system efficiency would be well suited for a variety of robotics tasks [1, 57, 58, 61].

One such task that could benefit from fast and efficient SNNs is the visual place recognition (VPR) problem, where incoming query images are matched to a potentially very large reference database, with a range of applications in robot localization and navigation [3, 5, 21, 22, 30, 49, 50, 65], including as a loop closure component in Simultaneous Localization and Mapping (SLAM) [12, 23, 50, 62, 63]. However, VPR remains challenging as query images often have significant appearance changes when compared to the reference images, with factors such as time of day, seasonal changes, and weather contributing to these differences [33, 35, 66]. SNNs represent a unique way to solve VPR tasks for their low-latency and energy efficiency, especially where this is an important consideration for the overall design of a robot [26]. The flexible and adaptive learning that SNNs take advantage of make them ideal for VPR tasks, as network connections and weights will learn unique place features from traversal datasets.

SNNs traditionally use a rate encoding method with substantial computational costs due to its reliance on spike counts [13, 17, 46]. Our work instead adopts a temporal encoding strategy inspired by central information storage techniques used by the brain, reducing the overall content the network processes during learning [52, 54]. This takes a different approach to what information each spike is representing and transmitting when compared to previous studies like those by Hussaini et al. [21, 22]. We leverage a simplified SNN framework [54], modular networks [6, 18, 25], and one-hot encoding for supervised training to substantially decrease training and inference times. Compared with previous systems, our SNN achieves query speeds exceeding 50 Hz on CPU hardware for large reference databases (\(>\)27k places) and even higher inference speeds when deployed on GPUs (as high as 500 Hz), indicating its potential usefulness for real-time applications [5, 19, 21, 30, 32, 36, 65].

Specifically, the key contributions of this work are:

1. We present VPRTempo, a novel SNN system for VPR that for the first time encodes place information via a temporal spiking code (Figure 1), significantly increasing the information content of each spike.
2. We significantly lower the training time of spiking networks to sub-hour time frames _and_ increase query speeds to real-time capability on both CPUs and GPUs, with the potential to represent tens of thousands of places even in resource-limited compute scenarios.
3. We demonstrate that our lightweight and highly compute efficient system results in comparable performance to popular place recognition systems like NetVLAD [5] on the Nordland [40] and Oxford RobotCar [34] benchmark datasets.
To foster future research and development, we have made the code available at:

[https://github.com/QVPR/VPRTempo](https://github.com/QVPR/VPRTempo)

## II Related Works

In this section, we review previous works about VPR (Section II-A), how robotics have used and deployed SNNs (Section II-B), using SNNs to perform VPR tasks (Section II-C), and using temporal encoding in SNNs (Section II-D).

### _Visual place recognition_

Visual place recognition (VPR) is an important task in robotic navigation and localization for an accurate, and ideally comprehensive, representation of their environment and surroundings. The basic principle of VPR is to match single or multiple query image sets to previously seen or traversed locations in a reference database [33, 35, 50, 66]. This remains challenging for numerous reasons, including but not limited to: changes in viewpoint, time of day, or severe weather fluctuations [15, 51].

Several systems have been deployed to tackle this problem, ranging from simple approaches such as Sum of Absolute Differences (SAD) [36], over handcrafted systems like DenseVLAD [59] to learned approaches like NetVLAD [5, 36] and many others including [3, 30, 65]. These systems are commonly used in localization tasks such as loop closure in Simultaneous Localization And Mapping (SLAM) [60].

In this work, we are interested in alternative spiking neural network solutions to approach place recognition, which have desirable characteristics such as being able to have online adaptation and energy efficiency, especially when deployed on specialized neuromorphic hardware [2, 41, 42, 44].

### _SNNs in robotics_

Thanks to these characteristics, SNNs have been deployed to perform a variety of robotics tasks, including in the physical interaction domain for robotic limb control and manipulation [57], scene understanding [27], and object tracking [29]. Of significant interest is the potential to combine neuromorphic algorithms and hardware for these tasks [61], since this has the capacity to decrease compute time and conserve energy consumption where this is a concern (e.g. battery powered autonomous vehicles). However, it is important to note that the deployment and use cases of SNNs in robotics is limited and has been mostly constrained to simulations or indoor/small-scale environments [21, 28].

### _Spiking neural networks for robot localization_

Neuromorphic computing involves the development of hardware, algorithms, and sensors inspired by neuroscience to solve a variety tasks [9, 55, 56, 61, 65]. Clearly, the brain is robustly capable of place recognition in a variety of contexts, providing a solid rationale to explore neuromorphic systems for VPR related challenges. A recent study exhibited prolonged training and querying times in an SNN developed with the Brian2 simulator, due to the reliance on rate encoding and modeling complex neuronal dynamics [21]. Robotic localization tasks have also employed SNNs to perform SLAM [14, 56], encode a contextual cue driven multi-modal hybrid sensory system for place recognition [65], and navigation [16, 31]. Our approach mitigates traditional barriers to deploying SNNs for real-time compute scenarios, enhancing the learning speed substantially by simplifying network processes and incorporating temporal spike encoding.

### _Using temporal encoding in spiking networks_

Temporal encoding has, to date, not been utilized for VPR tasks but is a common method used in SNNs [7, 11, 47, 52]. Sometimes referred to as a latency code, rather than using the number of spikes to encode information, the timing of the spike is taken into consideration. This is particularly an important concept when designing a system that updates weights using spike timing dependent plasticity (STDP) [45], as the temporal information of a pre-synaptic spiking neuron can help determine which post-synaptic neurons to connect

Fig. 1: **A-i** Traversal image sequences from standard VPR datasets (Nordland, Oxford RobotCar) are filtered and processed to be converted into **A-ii** spikes where the pixel intensity determines amplitude. In order to temporally encode spikes to an abstracted theta oscillation, **A-iii** amplitudes determine the spike timing during a timestep. **B-i** Once spikes have been generated, they are passed into a SNN with 3 layers, an input, feature layer, and a one-hot encoded output layer where each output neuron represents one place. **B-ii** In order to scale the system for large datasets, we train individual expert module SNNs of up to 1000 places from subsets of an entire traversal dataset.
Various temporal coding strategies have been used for image classification where it achieved very high accuracy [10, 47]. One way to achieve temporal coding is to define the pixel intensity of an image not by the number of spikes the system propagates, but the timing of a single spike in a time-step [54]. Another method to achieve a similar outcome is to model the oscillatory activity of the brain to modulate when spikes occur, relative to the phase of a constant, periodic shift in a neurons internal voltage [4, 24, 41].

## III Methodology

This work naturally expands previously published works on SNNs for VPR. Hussaini et al. [21] have introduced a scalable means of representing places, whereby independent networks represent geographically distinct regions of the traverse. However, as reviewed in Section II-C, their network used rate coding with complex neuronal dynamics, which resulted in significant training times and non-real-time deployment. Here, by leveraging the temporal coding in conjunction with spike forcing proposed in BliTNet [54], we overcome these limitations and demonstrate that BliTNet, combined with modularity, results in a high-performing VPR solution. We have completely re-implemented BliTNet in PyTorch [43], optimizing for computational efficiency and fast training times, thereby making it well-suited for deployment on compute-bound systems.

This section is structured as follows: We first briefly introduce the underlying BliTNet in Section III-A. This is followed by the modular organization of networks in Section III-B. We then describe our novel efficient parallelizable training and inference procedure in Section III-C. After which we describe our implementation in Section III-D, the datasets used in Section III-E, evaluation metrics in Section III-F, the baseline methods that we compare and contrast our network to in Section III-G, and finally our strategy for optimizing system hyperparameters in Section III-H.

### _Temporal coding for visual place recognition_

**Network architecture:** Each network consists of 3 layers. The input layer \(L_{I}\) has as many neurons as the number of pixels in the input image, i.e. \(W\cdot H\) neurons with \(W\) and \(H\) being the width and height of the input image, respectively. Neurons in \(L_{I}\) are sparsely connected to a feature layer \(L_{F}\). The output layer \(L_{O}\) is one-hot encoded and fully connected to the \(L_{F}\) layer such that each neuron \(n_{i}\in L_{O}\) represents one geographically distinct place from a set of traversal images \(\mathcal{D}=\{p_{1},p_{2},...,p_{N}\}\), where the number of places \(N\) equals the number of output neurons \(|L_{O}|\). For training that uses multiple traversals over different days/times, the same output neuron is used to encode that place so the network can learn changes to environments.

**Network connections:** Neuronal connections between the different layers can be excitatory, inhibitory, or both and are determined probabilistically. Connections from \(L_{I}\to L_{F}\) are sparse and determined by an excitatory and inhibitory connection probability, \(P_{exc}\) and \(P_{inh}\) respectively. Connections from \(L_{F}\to L_{O}\) are fully connected, such that every neuron in \(L_{O}\) receives both excitatory and inhibitory input. Excitatory and inhibitory connections are individually defined since inhibitory weights undergo additional normalization (refer to the Homeostasis subsection in III-A).

**Postsynaptic spike calculation:** The network state \(x_{j}^{n}\) for neuron \(j\) in layer \(m\) evolves in the following way:

\[x_{j}^{n}=\sum_{m=1}^{N}\sum_{i}x_{i}^{m}(t)(W_{ji}^{+nm}-W_{ji}^{-nm})+C- \theta_{j}^{n}, \tag{1}\]

where \(x_{i}^{m}\) is input neuron \(i\) in layer \(m\), \(\theta\in[0,\theta_{max}]\) is the neuron firing threshold, \(C\) is a constant input, and \(W_{ji}^{+nm}\) and \(W_{ji}^{-nm}\) are the excitatory and inhibitory weights, respectively. \(x\) is clipped in the range \([0,1]\) in case of negative or large spikes.

**Weight updates and learning rules:** All weights between connected neurons are updated using spike timing dependent plasticity (STDP) rule [45, 54]. STDP strengthens a connection between two neurons when the pre-synaptic cell fires before the post-synaptic, and vice versa. As the spike amplitude represents the timing in an abstracted theta oscillation or time-step, we can determine whether a pre- or post-synaptic neuron fired first using:

\[\Delta W_{ji}^{nm}(t)= \tag{2}\] \[\frac{\eta_{\text{STDP}}(t)}{f_{j}^{n}}\cdot\Big{[}\Theta\big{(} x_{i}^{m}(t-1)\big{)}\cdot\Theta\big{(}x_{j}^{n}(t)\big{)}\cdot\big{(}0.5-x_{j}^ {n}(t)\big{)}\Big{]},\]

where \(W_{ij}^{nm}\) refers to both positive and negative weights, \(\eta_{\text{STDP}}\) is the STDP learning rate, \(f_{j}^{n}\) is the target firing rate of neuron \(j\) in layer \(n\), \(\Theta(\cdot)\) is the Heaviside step function, \(x\) is the spike amplitude of pre- or post-synaptic neurons, and \(t\) is the timestep. Effectively, a pre-synaptic neuron firing before a post-synaptic one will undergo a positive weight shift (synaptic potentiation). The inverse of this scenario will result in a negative weight shift (synaptic depression). To ensure that the weights persist as positive or negative connections, they cannot change sign during training. Therefore, if a sign change is detected then that connection will be reset to \(\epsilon=10^{\pm 6}\).

The \(\eta_{\text{STDP}}\) is initialized to \(\eta_{\text{STDP}}^{\text{init}}\) and annealed during training according to:

\[\eta_{\text{STDP}}(t)=\eta_{\text{STDP}}^{\text{init}}(1-\tfrac{t}{T})^{2}, \tag{3}\]

where \(t\) is the current time step and \(T\) is the total number of training iterations.

**Homeostasis:** Inhibitory connections undergo additional normalization to balance and control excitatory connections. Whenever the sum input to a post-synaptic neuron is positive, the negative weights increase slightly. The inverse occurs when the net input is negative to post-synaptic neurons. Both cases are implemented by:

\[W_{ji}^{-nm}(t)\gets W_{ji}^{-nm}\Big{(}1-\eta_{\text{STDP}}(t)\cdot \Theta\big{(}\sum_{i}x_{i}^{m}(t)\big{)}\Big{)}. \tag{4}\]
When the network is first initialized, neurons have randomly generated firing thresholds which may never be crossed depending on the input. To prevent neurons from being consistently inactive, we use an Intrinsic Threshold Plasticity (ITP) learning rate \(\eta_{\text{ITP}}\) to adjust the spiking threshold to an ideal value for post-synaptic neurons:

\[\Delta\theta_{j}^{n}(t)=\eta_{\text{ITP}}(t)\cdot\Big{(}\Theta\big{(}x_{j}^{n}(t )\big{)}-f_{j}^{n}\Big{)}. \tag{5}\]

If a threshold value goes negative, it is reset to 0. \(\eta_{\text{ITP}}\) is initially set to \(\eta_{\text{ITP}}^{\text{init}}\) and annealed as per Equation 3.

**Spike forcing:** Spike forcing [54] was used in the output layer \(L_{O}\) to create a supervised readout of the result that is represented in the feature layer \(L_{F}\), similar to the delta learning rule [48]. For each learned place \(p_{i}\), the assigned neuron \(n_{i}\) in the output layer \(L_{O}\) (refer to III-A subsection Network Architecture) was forced to spike with an amplitude of \(x_{\text{force}}=0.5\).

The network uses the differences of the calculated spikes from \(L_{F}\to L_{O}\) to the \(x_{\text{force}}\) to encourage the amplitudes to match. STDP learning rules strengthen connections between pre-synaptic neurons that cause output spikes and weakens those that do not:

\[\begin{split}\Delta W_{ji}^{nm}(t)=\\ \eta_{\text{STDP}}(t)/f_{j}^{n}.[x_{i}^{m}(t-1)(x_{\text{force}}^{n }j(t)-x_{j}^{n}(t)].\end{split} \tag{6}\]

### _Modular place representation for temporal codes_

The brain encodes scene memory with place cells into sparse circuitry using engrams, individual circuits of neurons that activate in response to external cues for recall [37]. To mimic the concept of an engram, we used modules of individually trained networks to learn subsets of traversal datasets since the brain does not encode place recognition in a singular network.

By training multiple individual networks we gain several advantages: 1) Smaller networks train faster and are more accurate, 2) since the probability of connections, firing thresholds, and firing rates across \(L_{I}\to L_{F}\) is uniformly random, a query image \(q\) trained in network \(N_{i}\) is unlikely to activate output neurons with a high enough amplitude in other networks to generate a false positive match, and 3) similar to what has been shown in previous work [21], modularizing greatly improves the scalability of the system to learn more places for VPR.

To that end, we employ a system that can simultaneously train non-overlapping subsets of images into separate networks \(N_{i}\) and then test query images \(q\) across all networks at once [21]. Formally the union of all networks \(U\) is described as:

\[U=\underset{i=\{1,\ldots,|N|\}}{\cup}\ N_{i}\text{ with }N_{i}\ \cap N_{j}\ =\ \emptyset\ \forall_{i}\ \neq\ j. \tag{7}\]

### _Efficient implementation_

Our efficient implementation for VPRTempo involves training and querying a 3D weight tensor \(\mathbf{T}\in\mathbb{R}^{|N|*|L_{i}|*|L_{j}|}\) with \(|N|\) being the number of modules, \(|L_{i}|\) the number of the neurons in the pre-synaptic layer (either \(L_{I}\) or \(L_{F}\)), and \(L_{j}\) being the number of neurons in the post-synaptic layer (\(L_{F}\) or \(L_{O}\)). This setup capitalizes on parallel computing to boost efficiency and speed [43]. During training, the weight tensor \(\mathbf{T}\) is multiplied by an image tensor \(\mathbf{I}\in\mathbb{R}^{|N|*|L_{i}|}\) that holds images associated with a particular module and their input spike rates. At deployment time, the single query image is fed to all modules concurrently, leveraging parallel processing to decrease the overall inference time.

### _Implementation details_

Our network was developed and implemented in Python3 and PyTorch [43]. The system is trained on non-overlapping and geographically distinct places from multiple standard traversal datasets (Nordland and Oxford RobotCar [34, 40]), as commonly used in the literature [21, 22, 38, 50]. All reference and query input images underwent preprocessing for gamma correction, resizing, and patch normalization [36]. Specifically, Gamma correction was used to normalize pixels \(\rho_{i}\) of the input images:

\[\rho_{i}^{norm}\ =\ \begin{cases}\rho_{i}^{\gamma}&\text{for}\quad 0\geq\rho_{i}^{ \gamma}\leq 255\\ 255&\text{for}\quad\rho_{i}^{\gamma}>255,\end{cases} \tag{8}\]

where \(\gamma=\frac{e^{\lambda\times 255}}{e^{\mu}}\) with \(\lambda=0.5\) and \(\mu=\bar{\rho_{i}}\). Normalized images were then resized to \(W\times H=28\times 28\) pixels and patch-normalized with patch sizes \(W_{P}\times H_{P}=7\times\) 7 pixels [36]. Network spikes \(x\) are defined as floating point amplitudes in the range [0, 1], where \(x=1\) is a full spike and \(x=0\) is no spike. Initial input spikes are generated from pixel intensity values \(i=[0,255]\) from training or test images and converted to amplitudes by \(x=\frac{i}{255}\).

As an abstraction of theta oscillations in the brain, the spike amplitude determines where in a timestep the spike occurs, where 1 timestep is equivalent to one phase of theta (Figure 1). The network hyperparameters after performing a grid search (Section III-H) were set as to the values in Table I. Network modules were trained to learn 1100 places with 3 modules (totalling 3300 places) and 900 places with 3 modules (totalling 2700 places) for the comparisons presented in Figure 2 and Table II, Figure 3, respectively.

Each training epoch contained images from multiple traversals of the datasets of different day/time and were trained for 4 epochs in total. The training of each module is done simultaneously such that for each epoch, multiple unique places can be learned at the same time. After the network trained for sufficient epochs, all modules were simultaneously queried with independent network activation states to perform place matching.
### _Datasets_

We follow the suggestion by Berton et al. [8] to have training and reference datasets that cover the same geographic area, rather than the common VPR practice to train networks on a training set that is potentially disjoint from the deployment area (i.e. reference dataset). Specifically, our network was evaluated on two VPR datasets, Nordland [40] and Oxford RobotCar [34] with image subsets and training performed as previously described [21]. Briefly, the Nordland dataset covers an approximately 728km traversal of a train in Norway sampled over Summer, Winter, Fall, and Spring. As is standard in the field, filtered images from the Nordland dataset removed any segments containing tunnels or speeds \(<\) 15 km/hr [20, 38, 21].

Images from both datasets were sub-sampled every 8 seconds, which is roughly 100 metres apart for Nordland, and 20 metres for Oxford RobotCar resulting in 3300 and 450 total places, respectively. It is important to note that while VPRSNN trained on these number of images, it only queried 2700 and 360 places respectively due to the 20% of input images used for calibration [21]; note also that our proposed VPRTempo does not require a calibration dataset.

### _Evaluation metrics_

When a query image \(q\) is processed by the network, the matched place \(\hat{p}\) is the place \(i\) that is assigned to the neuron \(n_{i}\) in the \(L_{O}\) with the highest spike amplitude \(f_{i}\):

\[\hat{p}=\operatorname*{arg\,max}_{i}f_{i}. \tag{9}\]

Our main metric for overall evaluation of the network is precision at 100% recall (P@100R) [50], which was used to determine performance when compared to other state-of-the-art VPR systems. P@100R measures the percent of correct matches when the network is forced to match every query image with a reference image. Recall at \(N\) (R@\(N\)) measures if the true place is within the top \(N\) matches. A match is only considered a true positive if it aligns with the exact ground truth, i.e. there is no ground truth tolerance around the true match.

### _Baseline methods_

We evaluated our system against standard VPR methods and state-of-the-art SNN networks. Firstly, the simple sum of absolute differences (SAD) baseline calculates the pixel-wise absolute difference between query and reference database images and selects a match based on the lowest sum value [36]. For SAD, images were resized to the same width and height used in our system (28 x 28 pixels). NetVLAD is trained to be highly viewpoint robust, and in this case images were kept at the original resolution [5]. We also compare with the current state-of-the-art Generalized Contrastive Loss (GCL) [30], which for Oxford RobotCar the dataset was resized to 240x320. We note that both Nordland and Oxford RobotCar are "on-the-rails" datasets with very limited viewpoint shift, which disadvantages GCL and NetVLAD. Finally, the main comparison is VPRSNN which is a recently reported SNN for performing VPR tasks based on spike rate coding by Hussaini et al. [21].

### _Hyperparameter search_

To tune hyperparameters, we initially used a random search to identify the most influential parameters on match accuracy. Specifically, the hyperparameters we optimized were: firing threshold \(\theta\), initial STDP learning rate \(\eta_{\text{STDP}}^{\text{init}}\), initial ITP learning rate \(\eta_{\text{ITIP}}^{\text{init}}\), firing rate range \(f_{min}\) and \(f_{max}\), excitatory and inhibitory connection probabilities \(P_{exc}\) and \(P_{inh}\), and the constant input \(C\). An initial random sweep of 5,000 identified parameters for a refined grid search, specifically for \(f_{min}\), \(f_{max}\), \(P_{exc}\), and \(P_{inh}\). The resulting hyperparameters can be found in Table I.

## IV Results

In this section, we establish the network training and query speeds when run on either CPU and GPU hardware (Section IV-A). Then, we compare the performance of the network when compared to state-of-the-art and standard VPR systems (VPRSNN [21], GCL [30], NetVLAD [5], and SAD [36]) (Section IV-B).

### _Training and querying speeds_

To establish how our network performed against the previous state-of-the-art SNN for VPR (VPRSNN), we measured the total time taken to train each network on 3300 places from the Nordland dataset [21]. We also tested query speeds of both networks, and the effect the number of places has on training and querying for our network (Figure 2).

VPRSNN learned 3300 places in approximately 360 mins compared with our system which only took 10% (60 mins) and 0.4% (1 mins) of the time to train an equivalent number

Fig. 2: **A** Comparison of training times for 3300 places from the Nordland dataset our system against state-of-the-art (VPRSNN [21]). VPRSNN trained in 360 mins, VPRTempo on a CPU trained in 60 mins, with our best performance of \(\approx\)1 min when VPRTempo runs on a GPU. **B** Querying speed 2700 places: VPRSNN 2 Hz, VPRTempo CPU at 353 Hz, and VPRTempo GPU queried at 1634 Hz. **C** Increasing the number of places scales the training time with a time complexity of \(\mathcal{O}(n)\) and inference time increases with a time complexity of \(\mathcal{O}(log~{}n)\).
of images when run on CPU and GPU hardware, respectively (Figure 2A). Whilst our network trained the fastest on GPU hardware, CPU training was still significantly faster than VPRSNN [21] indicating our system's capability for real-time operation when training new places online. We attribute this predominately to increased spike efficiency and the shift away from modeling biological complexity, as in the Brian2 simulator [53].

Our system is capable of real-time query deployment, with speeds on both CPU and GPU hardware for our network in the order of hundreds to thousands of Hz (Figure 2B), which is particularly useful for resource limited compute scenarios. A single query simultaneously activating all expert modules at these speeds shows the scalability of our method if larger datasets are employed. And finally, the time scaling of our system was found to be \(\mathcal{O}(n)\) for training time and \(\mathcal{O}(log~{}n)\) for query speed (Figure 2C). We next measured training and query speeds for the conventional SAD and NetVLAD and state-of-the-art GCL VPR methods, as summarized in Table II. Across the board, our network trained and queried substantially faster than all of the other methods, with \(\approx\) sub-hour training times on both CPU and GPU hardware and query speeds in the hundreds to thousands of hertz. This indicates that our network is suitable for real-time compute scenarios in resource limited systems.

We note that SAD has no training requirement to run and NetVLAD and GCL uses pre-trained models [5, 30]. Query speed for NetVLAD and GCL was measured as the time taken for query image feature extraction [5, 30]. Only CPU training or query speeds are listed for VPRSNN [21] since there is no GPU implementation of this network available.

### _Network accuracy_

Now that we have established the beneficial training and inference speed, we next evaluated our system accuracy when compared to conventional and state-of-the-art VPR systems. For the Nordland traversal dataset, our system achieved a P@100R of 56% (Table II). The conventional methods SAD and NetVLAD achieved an P@100R of 48% and 31% respectively, with the state-of-the-art GCL being 32%. Our main comparison competitor to VPRSNN achieving 53% (Table II). By comparison, for Oxford RobotCar dataset we achieved a P@100R of 37% compared to 40% for VPRSNN (best performer) (Table II). SAD, NetVLAD, and GCL measured at 37%, 31%, and 33% respectively. As previously discussed (refer to Section III-G), NetVLAD and GCL do not perform as well on static view-point datasets like Nordland and Oxford RobotCar. In addition to this, we calculated the precision-recall curves and R@N for both datasets to further validate our method, which are shown in Figure 3C and D.

## V Conclusions and future work

In this paper, we presented the first temporally encoded SNN to solve VPR tasks for robotic vision and localization. We significantly improved the capacity of SNN systems to learn and query place datasets over state-of-the-art and conventional systems (SAD [36], NetVLAD [5], GCL [30], VPRSNN [21]), demonstrating capability for real-time learning in deployment. In addition to this, we observed comparable network precision to these systems in correctly matching query to database references.

There are multiple future directions for this work and its application in robotic localization and VPR methods: 1) We are working toward translating our method onto Intel's neuromorphic processor, Intel Loihi 2 [41], to deploy on energy efficient hardware. 2) For deployment on neuromorphic hardware, we are investigating the use of event streams from event-based cameras as the input to our network in order

Fig. 3: **A** Example database and query image from the Nordland dataset (left) that are patch-normalized for network training (right). **B** Ground truth (GT, left) and descriptor similarity matrix from testing 2700 query images (right). **C** Precision-recall curves comparing our network with sum of absolute differences (SAD [36]), NetVLAD [5], Generalized Contrastive Loss (GCL [30]), and VPRSNN [21]. **D** Recall at N curves comparing methods as in **C**.
to further reduce latencies and improve energy-effciency. 3) Given our system's fast training and inference times, we will explore an ensemble fusing SNNs representing the same places for increased robustness. 4) Finally, we are exploring deployment of our network onto a robot for online and real-time learning of novel environments.
