Tracking a volleyball trajectory from video with vball-net

Tracking a volleyball trajectory from video with vball-net

2026/03/09


  A short story of how we got a lightweight network for detecting a volleyball with a performance of 200+ fps on a CPU (OpenVINO, i5-10400F)

Live demo of ball detection
github fast-volleyball-tracking-inference

I have a hobby - playing volleyball at the amateur level.
Professional teams have tools to analyze the game.
At the end of 2024, I saw a video from BallTime on Instagram.
This is an excellent service for detailed video analysis.

As an IT specialist, I became interested in how to implement at least part of similar functionality.

A search on the topic showed that there are works by other authors:
https://medium.com/better-programming/volleyball-serve-detection-with-machine-learning-68288a7e68eb

An interesting approach is to identify the ball through a classifier.
The easiest and most common way is to use YOLOv5/v8/v11 + ByteTrack.

The disadvantage of YOLO is that the volleyball is small: in the background it is ≈ 5x5 px with a video of 1920x1080.
YOLO networks do not work well on small objects.
You can use the SAHI approach (when the frame is submitted for detection in parts, and the result is collected into a full-size frame).

TrackNet - a network for searching fast sports objects

In the search results, I came across an article about using a network based on U-Net architecture to track the trajectory of a badminton shuttlecock or a tennis ball.

The advantage of TrackNet over YOLO is the use of multiple frames of video.
The neural network receives temporal information over three frames. YOLO works with each frame as a separate picture.

The key feature is that multiple frames are used.

I conducted the first tests with TrackNetV4 - tensorflow2.

The first difficulty I encountered was the dataset.
One of the most difficult tasks is preparing a dataset for training.
To repeat someone else's experiment, you need a dataset.
If your data is different from what the network was trained on, the result will be much worse.

When training initial models on a consumer RTX 3060 graphics card
on my data (~20,000 frames) one epoch took 50 minutes.
A week of marking - and I received my dataset for amateur Action Cam:

https://volleyball-orel.ru/static/system/docs/data202507112330.tgz

A Python script (cv2) was used to annotate the ball:
https://github.com/asigatchov/vball-net-pytorch/blob/main/src/utils/imgLabel.py

/media/photos/img1.jpg

How TrackNet turns into vball-net

When I launched the first inference, the speed was lower than stated in the articles.
I needed much more performance on the CPU (and on the GPU too).

TrackNetV4:
- input — 3 frames (9 channels per input)
- output — 3 heatmaps (3 channels)

Speed up vball-net

How can I speed up processing?

  • reduce the amount of data → make the frames black and white
  • increase the number of frames per pass

The network has already processed 9 channels → feed 9 grayscale frames.
We change the model so that there are 9 heatmaps at the output.

/media/photos/img2.jpg

The second hack to improve performance is to process each frame exactly once.
Each time we submit 9 new frames for input. This speeds up processing (compared to a sliding window) by about 9 times.

Sliding window: the central frame is the main one, the rest (1–4 and 6–9) are auxiliary.

We experimentally reduce the number of layers in the model and evaluate the accuracy/speed ratio.

Results of the first experiments:

vball-net tensorflow2
vball-net pytorch