Abstract
Synapses are the fundamental unit of neural connectivity. They exhibit dynamic functional and structural changes that enable the brain to learn, adapt, and form memories. Recent advances in endogenous protein fluorescent labeling offer an opportunity to image synaptic strength in vivo and thus study the mechanisms underlying adaptive neural computation in living mice. Studying synaptic dynamics requires tracking individual signals of small, densely packed synapses over days while they change in size, position, and intensity between imaging sessions, and may even appear/disappear entirely. Tracking >100,000 dynamic, submicrometer particles is difficult even for state-of-the-art algorithms. Moreover, most algorithms rely on an isotropic uncertainty ball, assigning equal weight to the lateral plane (XY) and to the noisier axial dimension (Z), leading to poorer performance. To address these challenges and accurately track synapses in vivo, we developed SynTrack. We formulated SynTrack as a Maximum A Posteriori estimation problem under the anisotropic uncertainty ball, along with a fully temporally connected spatio-temporal graph to overcome long-term occlusions. SynTrack achieves a mean track length of 0.51 μm with a Multiple Object Tracking Accuracy (MOTA) score of 88.8%, on par with MOTA scores of expert annotators but with massively increased speed and scalability. Over two weeks, we successfully track 65,000 synapses in 5.6 out of 8 imaging sessions on average, with 20,000 synapses being tracked in at least seven sessions. We present SynTrack as a state-of-the-art algorithm capable of high-resolution and fidelity tracking of synapse dynamics in behaving mice with unprecedented detail.
I. INTRODUCTION
Synapses are densely packed sub-micron structures that connect pairs of neurons and enable propagation of electrical signals across vast ensembles of neurons via synaptic neurotransmission. As animals form memories, adapt to their environment, and learn to perform new tasks, the molecular composition of synapses changes by strengthening or weakening, as well as creating or deleting synaptic connections between specific neurons. This process of dynamic remodeling of synapses is called synaptic plasticity, which has long been a central focus in neuroscience and is thought to underlie many forms of learning, memory, and behavioral adaptation.
AMPA-type glutamate Receptors (AMPARs) are known to be heavily involved in synaptic plasticity, specifically in long-term potentiation and depression [Malinow and Malenka, 2002, Huganir and Nicoll, 2013]. Given the critical role plasticity plays in the brain, the ability to track the timecourse and spatial orchestration of synaptic plasticity in living animals would significantly advance our understanding of this central function of the healthy brain, allow us to observe how synaptic deficits are manifested in neurological disease, and pave the way to understand new learning rules in artificial systems. However, studies of the computational impacts of plasticity have largely been theoretical [Morris et al., 1989, Fusi et al., 2000, Bicknell and Latham, 2025, Aitchison et al., 2021] due to the difficulty of observing and following the dynamics of hundreds of thousands of synapses in vivo across long time-scales. Only recently have microscopy, biological, and algorithmic tools advanced to the point of enabling the resolution of submicrometer-sized structures across multiple days, thus opening the door to such studies.
Nevertheless, the difficulties posed by in vivo data add significant resolution and motion challenges. Previous work imaging changes in AMPAR expression during learning tasks have been restricted to observing a sparse set of synapses (less than ≈1000 synapses per mouse [Roth et al., 2020]) or ex vivo studies using confocal microscopy in postmortem tissue [Rao-Ruiz et al., 2021]. More recently, new transgenic mouse lines [Graves et al., 2021], combined with multiphoton imaging [Helmchen and Denk, 2005] and novel algorithms for image enhancement [Xu et al., 2023] and segmentation [Chen et al., 2025], have reported longitudinally imaging of hundreds of thousands of synapses in vivo (Fig. 1). Such datasets finally provide faithful observations of large-scale synaptic changes, though identifying individual synapses and tracking their changes in strength over time (i.e. synaptic plasticity) with high fidelity remains a significant hurdle.
Fig. 1:
The synapse tracking problem. A) Synapse imaging, detection and tracking pipeline: after longitudinal 2-photon (2p) imaging in vivo, imaging volumes are aligned with affine registration, denoised with XTC [Xu et al., 2023], and synapses are detected with MR-CNN [Chen et al., 2025]. SynTrack was developed to link individual synapse detection between days to create longitudinal tracks. B) Snapshot of 3D imaging volume comprising of 65,000 synapses in a SEP-GluA2 mouse cortex. Pink and orange squares respectively represent the location of the XY and XZ planes shown in C. C) Longitudinal images in the XY (top) and XZ (bottom) planes after affine registration. Sum projection of 4 slices (1.33 μm thickness total). The lower Z resolution resulting from the Point Spread Function (PSF) of 2p microscopy underscores the need for SynTrack to take into account the larger positional uncertainty of synapses in the Z dimension.
Several key challenges make tracking densely labeled synapses in vivo difficult. First, the Point-Spread Function (PSF) inherent to optical imaging achieves poorer resolution along the axial dimension (Z) compared to XY planes, rendering an anisotropic image. This results in higher uncertainty of synapse structure and position in Z, and a tracking algorithm must be able to appropriately down-weight this noisier Z-dimension. While the dense signals of modern transgenic lines that label all excitatory synapses in the brain provide a unique approach to understand how synaptic plasticity drives cognition, the density of labeled synapses presents a challenge for matching and tracking hundreds of thousands of individual synapses across imaging sessions (Fig. 1b). Moreover, individual synapses lack distinctive features, and thus identity information is principally derived from their spatiotemporal location relative to other synapses (Fig. 1c) rather than from distinguishing shape or textures. The high dimensionality and limited individuality of synapse shape is further exacerbated by the limited Signal-to-Noise Ratio (SNR) inherent to in vivo imaging, which can impact the accuracy of localizing or even detecting a given synapse on one or more sessions. Thus, a tracking algorithm must be able to be re-identify missing synapses between days. Finally, as data are acquired by imaging large volumes of brain tissue, synapse tracking must be rendered in 3D.
Given these challenges and the novelty of large-scale synaptic imaging, the published synapse tracking literature has focused on manually tracking a small number of synapses from sparsely labeled samples by identifying their location relative to an anatomical anchor, e.g., a spine [Roth et al., 2020]. Beyond synapse tracking, there is a rich body of adjacent literature on tracking other objects, such as cells, wherein the most common paradigm consists of running an object detector followed by a linking algorithm, e.g., Nearest Neighbor [Sugawara et al., 2022], Hungarian Matching [Jaqaman et al., 2008, Fazli et al., 2018], or Deep Learning [Arbelle et al., 2018, Ben-Haim and Raviv, 2022]. Brain-wide imaging and tracking of extremely large numbers of neurons has been achieved, [Chen et al., 2024, Winnubst et al., 2019] lending support to the potential feasibility of tracking similar numbers of synapses in living mice across time. Unfortunately, current methods fall short of enabling accurate synaptic tracking. Current trackers, often designed for other domains such as tracking pedestrians, cannot simultaneously handle the lower signal-to-noise levels, anisotropic uncertainty from the imaging system, large number of objects to track, and lack of distinguishing features within synapse imaging datasets.
To meet the challenges of accurate synaptic tracking in living mice, We introduce a min-cost flow algorithm for in vivo tracking of hundreds of thousands of synapses: SynTrack. Our novel algorithm a) directly estimates an anisotropic PSF uncertainty ball from either labeled or unlabeled data, b) solves the min-cost-flow problem by using a cost-scaling algorithm to find the optimal association using information from all frames, and c) is computationally efficient enough to align hundreds of thousands of synapses in minutes. These qualities make SynTrack especially powerful in handling missing detections and re-identifications of densely packed synapses in living mice.
Contributions:
We introduce a novel parametrically flexible uncertainty estimation and gating procedure (Proposition 1) for arbitrary motion distributions. This is used to generate a sparse spatial, dense temporal min cost flow tracking graph which enables accurate synaptic tracking. We introduce a block coordinate descent procedure to perform label-free estimation of the uncertainty ball, which performs on par with labeled data from human experts. Finally, we use SynTrack on a longitudinal imaging dataset to successfully extract tracks for hundreds of thousand synapses over two weeks, achieving an unprecedentedly detailed visualization of synaptic changes over time in living mice. We demonstrate that tracks extracted via SynTrack recover a behavioral perturbation given to the mouse.
II. BACKGROUND AND RELATED WORK
Object tracking has a rich history. Starting with the seminal filtering works of [Kalman, 1960] on recursive bayesian posterior state estimation for a single target with gaussian noise and [Doucet et al., 2000] which approximates the posterior of a single target by particles to handle nonlinear transitions and noise. This was soon extended to multi-object tracking by Multiple Hypothesis Tracking framework of [Reid, 1979] and Joint Probabilistic Data Association framework of [Fortmann et al., 1983]. Note that these approaches were primarily designed for an online setting, and often restricted to tracking very few objects.
As an alternative to online methods, min-cost-flow methods were originally proposed in the context of offline pedestrian tracking. The classic paper by [Zhang et al., 2008] introduced network flow for use in multi-object tracking. Note that the Min-Cost-Flow-Based Algorithm in [Zhang et al., 2008] cannot be used off the shelf because it was designed to track pedestrians with appearance-based similarity loss that does not work to model synaptic motion. Unlike pedestrian tracking, which includes far more time points than objects, synaptic tracking involves extremely large numbers of objects over fewer time points. Thus, we need to explicitly handle a large numbers of missing detections. [Pirsiavash et al., 2011] and [Butt and Collins, 2013] reported results on min-cost flow with occlusion modeling for k frames to handle missing detections. We adopted a similar approach for SynTrack.
While literature in the field of in vivo synaptic tracking is essentially non-existent due to the novelty of such datasets, there a rich body in the related field of in vivo cell tracking. The simplest strategy in this domain utilizes nearest neighbor for data association [Sugawara et al., 2022]. Additional work has used greedy pairwise matching between frames based on Hungarian Matching [Jaqaman et al., 2008, Fazli et al., 2018]. More recent approaches employed deep-learning approaches for linking [Ben-Haim and Raviv, 2022]. While deep-learning algorithms have achieved the state of the art in segmentation, algorithms for linking detections requires dense annotations that are challenging to acquire for volumetric data. Furthermore, such methods also demonstrate poor generalizability to datasets that are “out of distribution” with respect to training data. In fact, a recent 10-year benchmark on the famous cell tracking challenge [Maška et al., 2023] has reported that traditional approaches for data association can be as effective as deep learning. Along with the relative homogeneity of synapse appearance, this was one driving factor behind our choice to follow a hybrid data association strategy (using continuous normalizing flow for learning motion distribution and min-cost flow for data association). Padfield et al. [2011] and Löffler et al. [2021] proposed a min-cost-flow tracking algorithm with appear/disappear nodes to handle cells appearing and disappearing due to microscope movement. Note that this approach does not handle re-identifications, which are quite common in longitudinal synapse imaging.
We note that the majority of the algorithms discussed here have used an isotropic uncertainty ball that treats movement in each dimension equally. The isotropic assumption, while helpful for simplifying the model and appropriate in many applications, is insufficient for modeling 3D in vivo synaptic data. Specifically, the optical properties of the point-spread function (PSF) stretch the data axially, producing an anisotropic uncertainty ball. Moreover, while past methods have relied on object features for tracking, such as appearance-based models [Zhang et al., 2008], synapses have minimal distinguishing features. Finally, many prior methods require labeled data, which is difficult to accurately annotate in volumetric synapse tracking at scale. Thus we require that our tracking solution have 1) the ability to capture anisotropic uncertainty, 2) be minimally reliant on object features, and 3) require minimal-to-no labeled data, in addition to 4) being scalable to 100,000+ objects and 5) be able to re-identify objects that are missing at a handful of intermediary time-points. By achieving all of these qualities, SynTrack makes a significant contribution to the state of the art.
III. METHOD
A. Registration Formulation and Denoising
Given a collection of volumetric images , we denoised each dataset independently using a previously developed autoencoder that was specifically designed to enhance in vivo two-photon synaptic imaging [Xu et al., 2023]. The image enhancement reduces background fluorescence levels and shot noise, making synapses more readily detectable. Once each dataset was denoised, we performed gross affine registration of the imaged volumes between sessions. Affine registration corrects for the large-scale motion in in vivo imaging due to, e.g., breathing or blood pressure changes. Specifically, given a set of voxel grid coordinates , we solve:
| (1) |
Here is the affine mapping function parameterized as . is computed via interpolation for locations off the grid. While affine registration roughly aligns sessions, primarily based on large-scale features such as dark areas corresponding to vasculature, it does not account for the microscopic movements and fluorescence changes that must be tracked using SynTrack.
B. Synapse detection
To detect and segment synapses, we used our previously developed modified Mask-R-CNN (MR-CNN) [Chen et al., 2025] that is designed to efficiently identify hundreds-of-thousands of objects in volumetric data. MR-CNN extracts each synapse’s location and brightness information by simultaneously identifying which voxels in the volume belong to any synapse, along with a per-synapse mask. From these masks we extracted the synapse’s location as defined by the centroid of the 3-dimensional segmentation, converted to physical coordinates.
C. Tracking: Network flow
1). Probabilistic Model:
For tracking, we begin with the formulation of Zhang et al. [2008], and expand on this work to address two main challenges: 1) handling anisotropic uncertainty in synapse locations and 2) re-identifying synapses that disappear and reappear despite the lack of distinct appearance cues. In this formulation we are given a set of detections with being the spatial coordinate and the time associated with the ’th detection. We define the following two functions: space : to extract the 3d position of a detection and the function time : , to get the associated time. Because of the homogeneity of synapse appearances, we primarily focus on the spatial location for tracking.
We begin with the definition of tracks. Let be a set of non-overlapping tracks where each track is defined as . We enforce time ordering of tracks: . We also disallow two tracks from covering the same detection, i.e .
Two sources of uncertainty can influence how tracks are inferred from the data: spatial uncertainty in the location of detections, and the probability that a synapse is detected at all in a given session. To model these sources of uncertainty we define 1) as the probability of successfully detecting a synapse and 2) as the parameter associated with spatial uncertainty. can encode, for example, a spatial covariance matrix or weights of a neural network encoding a nonlinear uncertainty probability distribution. and effectively parametrize the prior over tracks, and we are interested in using said prior to compute and optimize the posterior of tracks given the data so that we can estimate the tracks and parameters via maximum a posteriori (MAP) estimation. Specifically we can use Bayes rule as:
| (2) |
| (3) |
| (4) |
Note that in this formulation the data depends only on the tracks, which in turn depends on the uncertainty parameters.
Leveraging this posterior thus requires defining the likelihood and prior probabilities. Detections are assumed to be IID distributed: . The likelihood of each detection can be written as a Bernoulli distribution depending on whether or not it belongs the partial cover of tracks , where encodes the object detector confidence.
To capture the probabilistic continuation of a track into subsequent datasets, we model the prior probability of in Equation (2) as a factorizable Markov chain . Each track can further be written as: . By defining the spatial gap as and temporal gap as , we further factor the conditional density as the product of the probabilities over temporal and spatial displacements:
| (5) |
The above expressions define the probability of tracks given the time- and space- separation of detections across sessions. To practically use these probabilities we need to a) estimate an unknown spatial conditional density so that we can properly compute graph weights and b) decide on a good threshold to gate weights based on this density to sparsify the graph and improve the computational efficiency when scaling to extremely large numbers of tracks. In the case where is normally distributed, we would have exact expressions for the probabilities and could perform a simple truncation to retain the majority of the probability mass. However, is unknown and not necessarily analytically tractable, let alone normally distributed, removing the utility of a simple threshold. Instead, we leverage advances in normalizing flows [Kobyzev et al., 2020] to allow us to start with a simpler Gaussian density to capture the uncertainty in more complex situations.
Proposition 1 (Nonlinear gating via normalizing flow).
Given a random variable with density and a diffeomorphic transformation . Consider a radius ball as well as , the radius of ball containing probability mass . The ball corresponding to this radius is given by: . The density defined via change of variables has as an likelihood ball.
Remark 1 implies that one way to perform confidence truncation of is to check if (or equivalently ).
Proof.
Consider small volumes and in the latent space and ambient space, respectively. These are related by . Thus, the likelihood inside the ball can be written as
| (6) |
□
2). Examples of for different parameterizations of :
Proposition 1 allows us to perform gating for arbitrary probability densities beyond the normal distribution. In this section, we consider three examples of diffeomorphic transformations and how to perform truncation in each case:
A Diagonal Scaling (Isotropic) Transformation: . The confidence truncation for this is given by the isotropic ball: .
A Linear (Anistropic) Transformation: with . The confidence truncation of this is given by the Mahalanobis Ball: .
A Continuous Normalizing Flow: Given a smooth trajectory governed by the stationary dynamics , we parameterize as a flow of this ODE: , [Chen et al., 2018]. Unlike the other two cases, the confidence truncation of this does not have a closed formed expression and involves computing via flowing the ODE backwards .
3). Formulating MAP estimation as Min Cost Flow Problem:
We represent this probabilistic model as a directed graph . We have a set of non negative capacities associated with each edge. We also have edge costs and a supply-demand on each vertex.
We first define two special nodes source at time 0 and sink at time T. We duplicate the set of detection nodes and call this . Define the set of vertices:
We next define edges as per the following procedure: We first start with edges coming out of source . There is an edge from every node to sink . We use detection edges to encode confidence of object detector . We connect temporal edges to all future time points: . The set of edges is thus defined as .
We also define an edge capacity function with if where if if , and if where . We also define a node supply function with if if , and if . Let such that is the flow associated with edge . Give a vertex , we define and . The minimum cost flow problem is then defined as:
| (7) |
In order to perform label free estimation, we start with the log of the posterior
Optimizing this one variable at a time, we arrive at the following block coordinate ascent algorithm:
Algorithm 1.
Unlabeled Estimation of Motion Parameters
| Require: Detections , detection confidences |
| Ensure: Estimated tracks , spatial uncertainty |
| 1: repeat |
| 2: Track Update: |
| 3: Uncertainty Update: |
| 4: Detector Prob. Update: |
| 5: |
| 6: until convergence |
IV. RESULTS
We tested SynTrack on both simulated and real datasets. Simulated particle flows allowed us to experiment with point spread function and test SynTrack’s ability to adapt to anisotropic PSFs in a controlled manner. Furthermore, annotating data manually is highly time-consuming and simulations offer a direct way to generate a large amount of test data with ground truth. We then tested on real biological data comprising of: a) one ground truth dataset with 198 tracks on synapses annotated independently by two expert annotators b) a much bigger dataset with ≈ 65,000 unannotated synapses.
We evaluated SynTrack using three standard metrics: #Switches counting how many times the tracker incorrectly swaps an object’s identity during tracking, IDF1 evaluating how coherently the tracker maintains temporal identity and MOTA measuring overall tracking accuracy by combining errors like missed detections, false positives, and ID switches [Bernardin and Stiefelhagen, 2008].
A. Simulation
We generated synthetic synaptic data by sampling a template of synapses over a unit square [0, 1]2 from a homogeneous Poisson process. We first generate with to prevent particles from being to close together. The synapses exhibit small Brownian motion between days with . For all simulations, we generated 100 days of data. Of this, 50 were used for estimating the uncertainty distributions, while the remaining 50 were used for evaluation For each day, detections are sampled based on the imaging Point Spread Function (PSF): .
We modeled as a normalized probability distribution, using one of two parameterizations: The first a gaussian . In Figure 5, top row, we use a scaled parameterization with . True synapse locations were overlayed above with the PSF density for each synapse. Sampled detections are shown below. We computed differences for each synapse between successive days to compute the motion uncertainty ball (bottom left) which is normally distributed (Henze-Zirkler test). As shown in Table I, the isotropic model performed poorly across all three metrics. The anisotropic-Gaussian model gave less weight to the comparatively noisier Z dimension and relied more on XY and thus performed the second best, followed by the continuous normalizing flow-based model that had the highest MOTA and IDF1 and the lowest number of switches.
Fig. 5:
A) Synthetic data with normal gaussian PSF. Larger z uncertainty implies we should give lesser weight to z for tracking. The conditional motion distribution is also a multivariate normal distribution. B) Synthetic data with Laplace PSF and corresponding motion distribution. Conditional distribution of motion is non normal.
TABLE I:
Tracking Metrics for Gaussian PSF — Mean ± Std Dev across 100 trials. #Switches: ID swaps, MOTA: Multi Object Tracking Accuracy.
| Algorithm | MOTA (%) | IDF1 (%) | #Switches |
|---|---|---|---|
|
| |||
| Anisotropic Gauss. | 95.51 ± 1.66 | 89.18 ± 4.44 | 30.30 ± 12.66 |
| Cont. Norm. Flow | 95.59 ± 1.61 | 89.54 ± 4.24 | 30.25 ± 11.65 |
| Isotropic Gauss. | 90.89 ± 2.63 | 81.33 ± 4.42 | 55.71 ± 15.93 |
Next, we experimented with a Laplace PSF to see how well SynTrack adapted to non gaussian PSFs: . In Figure 5, bottom row, we use . The uncertainty ball, shown in bottom left is not normally distributed (Henze-Zirkler test), . Results for this experiment are reported in Table II. Here, the gap between continuous normalizing flow model and anisotropic gaussian is especially striking since the PSF and motion distributions are non normal.
TABLE II:
Tracking Metrics for Laplace PSF — Mean ± Std Dev across 100 trials.
| Algorithm | MOTA (%) | IDF1 (%) | #Switches |
|---|---|---|---|
|
| |||
| Anisotropic Gauss. | 88.18 ± 2.70 | 77.03 ± 4.19 | 75.25 ± 17.99 |
| Cont. Norm. Flow | 89.18 ± 2.50 | 77.22 ± 3.84 | 72.07 ± 16.40 |
| Isotropic Gauss. | 86.72 ± 2.74 | 75.23 ± 4.57 | 84.37 ± 17.67 |
B. Synapse imaging in mouse cortex
We next evaluated SynTrack on real, multi-day synapse imaging data of living mice. The complete dataset consisted of imaging fluorescently labeled synapses using two-photon microscopy. Briefly, this SEP-GluA2 transgenic mouse line enabled visualization of all GluA2-containing excitatory synapses throughout the brain [Graves et al., 2021, Xu et al., 2023]. This was achieved by transgenic labeling of all endogenous AMPAR GluA2 subunits with a green fluorescent tag: Super Ecliptic pHluorin (SEP). Thus, when excited by 910 nm light from a two-photon microscope through a cranial window surgically implanted above brain regions of interest, hundreds of thousands of individual GluA2-containing synapses appear as fluorescent puncta, whose fluorescent intensity is directly correlated with the functional strength of each synapse [Graves et al., 2021]. Data were collected over a 100μm3 volume for 8 imaging sessions spanning two weeks. Because the linear parameterization performed on par with nonlinear, we restricted ourselves to scaling/linear parameterizations for the synapse experiments.
A critical part of SynTrack is the uncertainty of how synapse locations changed between recording days, which was encoded in the spatial covariance matrix . Accordingly, estimating was an essential step, and we explored both supervised and unsupervised approaches to estimate the spatial covariance matrix. In the supervised case, we used labeled tracks provided by two human expert annotators. We then took the difference between consecutive timepoints to estimate the uncertainty in motion between successive days. These are . Next, we used block coordinate descent iterations described in Algorithm 1. Estimated covariance from this is referred to as .
To model missed detections, we fit a geometric distribution to the ground-truth tracks manually annotated by two experts. The fit distribution was used to estimate a missing probability from Expert 1, Expert 2, and Unlabeled Estimate , which was used in the geometric distribution in the transition function.
Given , we used the following heuristic to estimate the number of tracks. Assuming a coin flip model with true objects on a day, the number of observed detections will be . We thus set to be . In the ground truth dataset of Table III, this was equivalent to setting . In order to efficiently find pairs of neighbors and that are within Mahalanobis ball of each other, we converted them to euclidean distances by linear transformation and a CKDTree implementation in scipy. In all experiments, we used to achieve probability truncation.
TABLE III:
Comparison against classical algorithms and human annotators.
| Method | MOTA (%) | IDF1 (%) | #Switches |
|---|---|---|---|
|
| |||
| Expert 2 → Expert 1 | 87.8 | 82.7 | 91 |
| SynTrack Labeled | 89.8 | 83.3 | 76 |
| SynTrack Unlabeled | 89.0 | 80.4 | 82 |
| SynTrack Isotropic | 88.0 | 77.4 | 89 |
| Hungarian Matching | 84.7 | 74.3 | 114 |
| Nearest Neighbor | 76.5 | 73.3 | 174 |
| Ilastik Tracking with Learning | 24.6 | 43.7 | 120 |
Tracks generated by SynTrack have a mean spatial displacement of approximately 0.51 μm between consecutive days and were detected on an average of 5.6 out of 8 imaging sessions. Notably, the temporal and spatial statistics of SynTrack’s output closely match those derived from expert annotations, suggesting that the method produced biologically meaningful and consistent results, though at vastly improved speed compared to human annotators (a few seconds vs. 6–10 hours per imaging volume comprising of 200 synapses over 8 imaging sessions) .
Comparing Trackers:
To test SynTrack’s ability to “fit” a human annotator, in Table III, we used the estimate of our first Expert as the uncertainty ball in SynTrack, using Expert 1’s own tracks as ground truth. As expected, SynTrack was able to fit these tracks well and achieve a MOTA of 89.8% with only 76 ID swaps. In contrast, Expert 2 compared with Expert 1 achieved a MOTA of 87.8% with 91 ID swaps, indicating more dissimilarity. Thus, SynTrack is closer to Expert 1 than Expert 2 compared with Expert 1.
In order to benchmark SynTrack, we compared it against the following baselines: Hungarian Matching (adapted from [Jaqaman et al., 2008] and augmented to handle missing detections), Nearest neighbor and Ilastik tracking with learning.
As seen in Table III, SynTrack outperformed other algorithms like Hungarian Matching (MOTA 84.7%) and Nearest Neighbor (MOTA 75.8%). Out of 198 total tracks in the 8-day ground truth dataset, 91 tracks were perfect matches with SynTrack, 90 tracks were perfect matches between the two annotators, while Hungarian only perfectly tracked 41. Comparing consecutive days where synapses were present on both days, we found that SynTrack performed better than Hungarian, which gradually decreased in accuracy over time. This was observed to be in line with previous findings in cell tracking literature [Maška et al., 2023] where global data association methods using information from multiple frames tends to outperform greedy methods.
One interesting feature of SynTrack was its ability to reidentify “missing” synapses between imaging sessions. In Figure 4, we compared an XY slice from the ground truth dataset against SynTrack. SynTrack achieved good correspondence with ground truth and was able to reidentify the highlighted synapse that went missing on Day 8 and Day 12, as defined by both expert annotators.
Fig. 4:
SynTrack successfully reidentifies synapses that go missing and reappear on consecutive days (highlighted by green box). Top row shows ground truth tracks labeled by expert annotator. Bottom row shows the corresponding synapses automatically tracked by SynTrack. Synapse segmentations are color-coded according to their assigned track, with matching colors across columns indicating the same synapse track.
We were interested in assessing the effect of temporal component of our spatiotemporal loss (Eq 5) in reducing ID swaps (i.e. synapse matching errors across imaging sessions). In Table IV, we add results for both a spatiotemporal loss as described in equation 5 as well as a purely spatial version of the loss without the geometric distribution. The results in Table IV, reveal that the geometric link function consistently limited ID swaps and increased the MOTA score, possibly by penalizing tracks with much larger gaps between trajectories.
TABLE IV:
Effect of different spatial uncertainty balls and geometric link function on SynTrack performance. All gating was done at 3σ. lab: labeled spatial uncertainty ball; un: unlabeled spatial uncertainty ball; E1: Expert 1; E2: Expert 2.
| Method | Ref | MOTA (%) | IDF1 (%) | #Switches |
|---|---|---|---|---|
|
| ||||
| E2 | E1 | 87.8 | 82.7 | 91 |
| SynTrack | E1 | 89.8 | 83.3 | 76 |
| SynTrack | E1 | 89.4 | 83.9 | 79 |
| SynTrack | E1 | 88.7 | 80.0 | 84 |
| SynTrack | E1 | 88.6 | 80.1 | 85 |
| SynTrack | E1 | 89.0 | 80.4 | 82 |
| SynTrack | E1 | 88.4 | 80.2 | 86 |
| E1 | E2 | 88.8 | 82.7 | 83 |
| SynTrack | E2 | 87.6 | 78.2 | 92 |
| SynTrack | E2 | 86.8 | 78.0 | 98 |
| SynTrack | E2 | 88.0 | 81.2 | 89 |
| SynTrack | E2 | 86.8 | 80.9 | 98 |
| SynTrack | E2 | 87.0 | 77.4 | 97 |
| SynTrack | E2 | 86.3 | 76.9 | 102 |
Next, we demonstrated that applying SynTrack to unlabeled data yields synapse tracking with accuracy on par with human annotators. As seen in Table IV, comparing human Expert 2 to Expert 1 as ground truth, Expert 2 had a MOTA of 87.8% along with 91 ID swaps. On the other hand, SynTrack with uncertainty ball achieved a MOTA of 89% with just 82 ID swaps. Thus SynTrack performed as well as agreement between two expert annotators. Furthermore, SynTrack with motion learned from the second annotator also does well, with MOTA of 88.7% and 84 ID swaps, indicating that both labeled and unlabeled versions of SynTrack were effective at generalizing to a different annotator.
To further validate SynTrack, in Figure 3, we ran it on a larger volume. For each synapse within a given imaging session, synaptic strength was defined for each individual synapse as the summed fluorescence intensity of all voxels within the automatically segmented puncta. Synapses were then matched across imaging sessions, using SynTrack to “connect-the-dots” across sessions, generating 65,000 trajectories of each individual synapse. Changes in fluorescent intensity across each trajectory was used to report synaptic plasticity with single-synapse resolution (Figure 7), which has never been achieved at this scale. In order to perform dimensionality reduction of these trajectories, a natural tool of choice is non negative matrix factorization. In Figure 6, we show results from performing non-negative matrix factorization (NMF) on the tracks.
Fig. 3:
Qualitative Results from SynTrack. Synapse segmentations are color-coded according to their assigned track, with matching colors across columns indicating the same synapse track. White squares in the top row mark the regions shown as zoomed XY images in the middle row. Dotted line highlights the coordinate of the XY and XZ slices.
Fig. 6:

Low rank decomposition from NMF. Consistent pattern of decreasing activity in fluorescence in P1 along with spikes on Day 4 in P2 and Day 7 in P3 are observed.
We tried ranks from 1 to 4. A rank of 3 was found to be appropriate. The rank 3 factorization revealed three interesting patterns. P1 represented a steady drop in luminance, possibly encoding some sort of bleaching phenomena caused by multiple imaging sessions. P2 reached its peak activation on Day 4 while P3 had a peak on Day 7. P2 and P3 are especially functionally significant, since days 4 and 7 represent behavioral days where the strongest stimuli was presented to the mouse.
The CostScaling algorithm used by SynTrack has a polynomial computational complexity of [Király and Kovács, 2012] for a graph with nodes and edges and being the largest edge weight. For efficiency, we used a C++ implementation of the Cost Scaling algorithm provided by the LEMON library. This resulted in a highly efficient tracker: running SynTrack on a dataset of 65,000 synapses over 8 imaging days took roughly 20 minutes on a laptop.
V. DISCUSSION
In this paper, we present SynTrack, an in vivo Synaptic Plasticity Tracking algorithm. Our results showcase the novel ability to accurately track changes in synaptic strength across dense networks of tens of thousands of submicron synapses across two weeks in living mice. Put simply, this is the most detailed and comprehensive illustration of synaptic plasticity ever published. Beyond the proof-of-concept demonstration here, SynTrack can be used to track the synaptic foundations of any behavior by imaging any brain region of interest, provided sufficient optical access using in vivo two-photon microscopy. More broadly, the ability to accurately track longitudinal changes in fluorescent puncta intensity could be extended to other similar questions in neuroscience and biology. For instance, SynTrack could be used to follow changes in dendritic spine morphology and number to report structural plasticity associated with learning. Alternatively, these tools could be useful in tracking axonal boutons across either learning or development, or other fluorescently labeled proteins of interest, illuminating how complex biological systems form and remodel over time.
Despite the efficacy of SynTrack, there were several limitations. One of the big challenges was handling the large detector missing probability . We partially alleviated this by allowing skip connections with full temporal connectivity in the min cost flow graph. Next, we relied on a heuristic strategy for selecting number of tracks. We are interested in exploring approaches to estimate number of tracks from data in the future. We also restricted ourselves to linear registration which may still have some residual motion. Future work should focus on algorithms which combine tracking, nonlinear registration and detections, possibly by fitting images directly, and which also handle nonlinear registrations to further stabilize the motions.
Fig. 2:
A) We use a triangular template to simulate 6 noisy detections with deletes and reappearances:. The detection at disappears at Day 1 reappears at Day 4 at the location . B) SynTrack deals with both misses and reappearances by allowing flows to skip ahead in time and C) recovers the template morphology.
Acknowledgments
This work was supported by the National Institute of Neurological Disorders and Stroke under Grant R01NS134842.
REFERENCES
- Aitchison Laurence, Jegminat Jannes, Menendez Jorge Aurelio, Pfister Jean-Pascal, Pouget Alexandre, and Peter E Latham. Synaptic plasticity as bayesian inference. Nature neuroscience, 24(4):565–571, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Arbelle Assaf, Reyes Jose, Chen Jia-Yun, Lahav Galit, and Raviv Tammy Riklin. A probabilistic approach to joint cell tracking and segmentation in high-throughput microscopy videos. Medical image analysis, 47:140–152, 2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Ben-Haim Tal and Raviv Tammy Riklin. Graph neural network for cell tracking in microscopy videos. In European Conference on Computer Vision, pages 610–626. Springer, 2022. [Google Scholar]
- Bernardin Keni and Stiefelhagen Rainer. Evaluating multiple object tracking performance: the clear mot metrics. EURASIP Journal on Image and Video Processing, 2008(1):246309, 2008. [Google Scholar]
- Bicknell Brendan A and Latham Peter E. Fast and slow synaptic plasticity enables concurrent control and learning. eLife, 14, 2025. [Google Scholar]
- Butt Asad A and Collins Robert T. Multi-target tracking by lagrangian relaxation to min-cost network flow. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1846–1853, 2013. [Google Scholar]
- Chen Ricky TQ, Rubanova Yulia, Bettencourt Jesse, and Duvenaud David K. Neural ordinary differential equations. Advances in neural information processing systems, 31, 2018. [Google Scholar]
- Chen Susu, Liu Yi, Wang Ziyue Aiden, Colonell Jennifer, Liu Liu D, Hou Han, Tien Nai-Wen, Wang Tim, Harris Timothy, Druckmann Shaul, et al. Brain-wide neural activity underlying memory-guided movement. Cell, 187(3):676–691, 2024. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Chen Zhining, Coste Gabrielle I., Li Evan, Huganir Richard L., Graves Austin R., and Charles Adam S.. Automatic detection of fluorescently labeled synapses in volumetric in vivo imaging data. bioRxiv, jan 2025. doi: 10.1101/2025.01.22.634278. URL https://www.biorxiv.org/content/10.1101/2025.01.22.634278v1. Preprint. [DOI] [Google Scholar]
- Doucet Arnaud, Godsill Simon, and Andrieu Christophe. On sequential monte carlo sampling methods for bayesian filtering. Statistics and computing, 10:197–208, 2000. [Google Scholar]
- Fazli Mojtaba S, Vella Stephen A, Moreno Silvia NJ, Ward Gary E, and Quinn Shannon P. Toward simple & scalable 3d cell tracking. In 2018 IEEE International Conference on Big Data (Big Data), pages 3217–3225. IEEE, 2018. [Google Scholar]
- Fortmann Thomas, Bar-Shalom Yaakov, and Scheffe Molly. Sonar tracking of multiple targets using joint probabilistic data association. IEEE journal of Oceanic Engineering, 8(3):173–184, 1983. [Google Scholar]
- Fusi Stefano, Annunziato Mario, Badoni Davide, Salamon Andrea, and Amit Daniel J. Spike-driven synaptic plasticity: theory, simulation, vlsi implementation. Neural computation, 12(10):2227–2258, 2000. [DOI] [PubMed] [Google Scholar]
- Graves Austin R, Roth Richard H, Tan Han L, Zhu Qianwen, Bygrave Alexei M, Lopez-Ortega Elena, Hong Ingie, Spiegel Alina C, Johnson Richard C, Vogelstein Joshua T, Tward Daniel J, Miller Michael I, and Huganir Richard L. Visualizing synaptic plasticity in vivo by large-scale imaging of endogenous ampa receptors. Elife, 10:e66809, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Helmchen Fritjof and Denk Winfried. Deep tissue two-photon microscopy. Nature methods, 2(12):932–940, 2005. [DOI] [PubMed] [Google Scholar]
- Huganir Richard L. and Nicoll Roger A.. Ampars and synaptic plasticity: the last 25 years. Neuron, 80(3):704–717, Oct 2013. doi: 10.1016/j.neuron.2013.10.025. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Jaqaman Khuloud, Loerke Dinah, Mettlen Marcel, Kuwata Hirotaka, Grinstein Sergio, Sandra L Schmid, and Gaudenz Danuser. Robust single-particle tracking in live-cell time-lapse sequences. Nature methods, 5(8):695–702, 2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Kalman Rudolph Emil. A new approach to linear filtering and prediction problems. 1960. [Google Scholar]
- Király Zoltán and Kovács Péter. Efficient implementations of minimum-cost flow algorithms. arXiv preprint arXiv:1207.6381, 2012. [Google Scholar]
- Kobyzev Ivan, Prince Simon JD, and Brubaker Marcus A. Normalizing flows: An introduction and review of current methods. IEEE transactions on pattern analysis and machine intelligence, 43(11):3964–3979, 2020. [Google Scholar]
- Löffler Katharina, Scherr Tim, and Mikut Ralf. A graph-based cell tracking algorithm with few manually tunable parameters and automated segmentation error correction. PloS one, 16(9):e0249257, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Malinow Roberto and Malenka Robert C. Ampa receptor trafficking and synaptic plasticity. Annual review of neuroscience, 25(1):103–126, 2002. [Google Scholar]
- Maška Martin, Ulman Vladimír, Delgado-Rodriguez Pablo, Gómez-de Mariscal Estibaliz, Nečasová Tereza, Guerrero Peña Fidel A, Ren Tsang Ing, Meyerowitz Elliot M, Scherr Tim, Löffler Katharina, et al. The cell tracking challenge: 10 years of objective benchmarking. Nature Methods, 20(7):1010–1020, 2023. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Morris Richard GM, Halliwell Robert F, and Bowery N. Synaptic plasticity and learning ii: do different kinds of plasticity underlie different kinds of learning? Neuropsychologia, 27 (1):41–59, 1989. [DOI] [PubMed] [Google Scholar]
- Padfield Dirk, Rittscher Jens, and Roysam Badrinath. Coupled minimum-cost flow cell tracking for high-throughput quantitative analysis. Medical image analysis, 15(4):650–668, 2011. [DOI] [PubMed] [Google Scholar]
- Pirsiavash Hamed, Ramanan Deva, and Fowlkes Charless C.. Globally-optimal greedy algorithms for tracking a variable number of objects. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1201–1208, June 2011. [Google Scholar]
- Rao-Ruiz Priyanka, Visser Esther, Mitrić Miodrag, Smit August B, and Van den Oever Michel C. A synaptic framework for the persistence of memory engrams. Frontiers in Synaptic Neuroscience, 13:661476, 2021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Reid Donald. An algorithm for tracking multiple targets. IEEE transactions on Automatic Control, 24(6):843–854, 1979. [Google Scholar]
- Roth Richard H, Cudmore Robert H, Tan Han L, Hong Ingie, Zhang Yong, and Huganir Richard L. Cortical synaptic ampa receptor plasticity during motor learning. Neuron, 105(5):895–908, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Sugawara Ko, Çevrim Çağrı, and Averof Michalis. Tracking cell lineages in 3d by incremental deep learning. Elife, 11:e69380, 2022. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Winnubst Johan, Bas Erhan, Ferreira Tiago A, Wu Zhuhao, Economo Michael N, Edson Patrick, Arthur Ben J, Bruns Christopher, Rokicki Konrad, Schauder David, et al. Reconstruction of 1,000 projection neurons reveals new cell types and organization of long-range connectivity in the mouse brain. Cell, 179(1):268–281, 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Xu Yu Kang T, Graves Austin R, Coste Gabrielle I, Huganir Richard L, Bergles Dwight E, Charles Adam S, and Sulam Jeremias. Cross-modality supervised image restoration enables nanoscale tracking of synaptic plasticity in living mice. Nature Methods, 20(6):935–944, 2023. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Zhang Li, Li Yuan, and Nevatia Ramakant. Global data association for multi-object tracking using network flows. In 2008 IEEE conference on computer vision and pattern recognition, pages 1–8. IEEE, 2008. [Google Scholar]





