open model · neuromorphic

Versalit SNN-Forecast

A spiking neural network that only sees past events and draws where the object will be — with almost three times less error than straight-line extrapolation.

Apache-2.0spiking network (SNN)7.7 px mean errorsynthetic data
Cyan: the past. Grey: the real future. Green: the future predicted by the SNN. In the middle, the events the network receives. The number on the panel is the error of the prediction at that instant, on this trajectory only — it ranges from 2.7 to 15.7 px; the 7.7 px in the table is the mean over 1,000 trajectories.

What it does

Show the network the events of a moving ball over the last 32 frames, and it draws where the ball will be 4, 8, 12, 16 and 20 frames later — including the curve of the fall and the bounce on the ground.

The network gets no position and no velocity. Only events.

How it works

The 32 frames of history become 8 event frames, and each one is fed to the network for 2 timesteps. Three convolutions and a dense layer, all with LIF neurons, keep the motion dynamics in the membrane potential itself — no huge window, no RNN. The output accumulates potential and becomes the 5 future positions.

Training is 100% synthetic: a simulator generates ballistic trajectories with gravity, bounces and wall reflections, a new one for every example.

simulator → frames → ON/OFF events (DVS)
  32 frames of history = 8 event frames × 2 timesteps
  → 3 convolutions + LIF → dense (128) + LIF
  → output accumulates potential → position at +4, +8, +12, +16, +20

Metrics on unseen trajectories

HorizonSNN (events only)Straight line*Standing still*
+4 frames6.56.28.4
+87.713.813.5
+127.721.817.5
+168.029.620.5
+208.437.022.8
Mean7.721.716.5

How to read it: error in pixels on a 64×64 grid, measured on 1,000 new trajectories. Both baselines (*) get the object's true position — information the SNN does not have. Even so, from +8 frames on the SNN is far more accurate: it learned gravity and the bounce; a straight line does not know the ball is going to fall.

What about real video?

The repository includes a second, much smaller model (10,762 parameters) that reads car trajectories extracted by a tracker and predicts a correction on top of straight-line extrapolation. On real traffic, the correction only helped at the longest horizon: at +20 frames the error dropped from 80 to 44 pixels, but from +4 to +16 frames the plain straight line was better.

That is why it stays in the repository as an experiment, with the full numbers in the model card — not as a result.

How to run it

git clone https://huggingface.co/delvek/versalit-snn-forecast
cd versalit-snn-forecast
pip install -r requirements.txt
python -m src.demo -o forecast.mp4   # synthetic demo
python -m src.train --epochs 30      # on-the-fly trajectories

Real video (experimental)

python -m src.extract_trajs video1.mp4 video2.mp4
python -m src.train_real --epochs 40
python eval_real.py video.mp4        # vs. linear extrapolation

Honest limitations

  • The strong result is synthetic: one object, clean background, simple physics, a 64×64 grid.
  • On real video, the SNN only beats the straight line at +20 frames.
  • The event camera is simulated from regular video.