I’m glad to share a PyTorch-based implementation of spike inference from calcium imaging data: CascadeTorch, now available on GitHub.
The original Cascade repository remains fully supported. This post explains why I re-implemented Cascade in Torch, and what this means for users.

What is Cascade?
Cascade is a deep learning-based method for inferring neuronal spike rates from calcium imaging signals (ΔF/F traces). It uses convolutional neural networks trained on a large ground-truth database of simultaneous electrophysiology and calcium recordings. The original publication in 2021 was trained on a broad range of datasets; more recent versions were trained on mouse spinal cord data and, most recently, on variants of the new sensor GCaMP8.
Cascade was originally implemented using TensorFlow/Keras because I this framework showed the highest promise back in 2019/2020. Since then, Cascade has been widely used for spike inference across imaging conditions by many labs.
Why switch to PyTorch?
Since 2021, when we published Cascade, the machine learning community has largely shifted toward other frameworks such as PyTorch or JAX in recent years. An example of this shift in the neuroscience community is DeepLabCut, which recently transitioned from TensorFlow to PyTorch as its primary backend. Installing PyTorch and TensorFlow in parallel is sometimes tricky and can create dependency conflicts of package or GPU driver versions.
What is CascadeTorch?
CascadeTorch is a 1:1 reimplementation of Cascade in PyTorch. That means, the network architecture is identical to the original TensorFlow version, and original pretrained models are simply converted to PyTorch by copying the weights.
Therefore, if you run the same input ΔF/F trace through a TensorFlow model and its converted PyTorch equivalent, you obtain the same spike rate prediction.
Compatibility and support
The original TensorFlow-based Cascade will be fully supported also in the future, and pretrained models are available in both formats. However, if you are starting a new project, I recommend using CascadeTorch. The switch is very straightforward. Simon Ball, who performed some initial tests with CascadeTorch, reported that he’s “getting the same results, and with no changes other than pointing the module import to your forked repository”. Please check out CascadeTorch directly on GitHub:
https://github.com/PTRRupprecht/CascadeTorch
If you have any feedback, please reach out by opening an issue on GitHub or by writing to cascade+p.t.r.rupprecht@gmail.com!