Skip to content

Commit ddb6856

Browse files
committed
nvdec x8
1 parent 36e4c9f commit ddb6856

2 files changed

Lines changed: 59 additions & 41 deletions

File tree

‎docs/api.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Global SimBA settings and environment variables — GPU toggles, default paths,
187187
<source src="_static/img/gpu_spin.webm" type="video/webm">
188188
</video>
189189

190-
CUDA/CuPy-accelerated versions of SimBA's compute-heavy routines — geometry, image, background subtraction, statistics, circular statistics, time-series, and SHAP — consolidated in one place. On a supported NVIDIA GPU they produce the same results as their CPU counterparts but run orders of magnitude faster on large datasets, with per-function expected-runtime tables to help you gauge the speed-up.
190+
CUDA/CuPy-accelerated versions of SimBA's compute-heavy routines — geometry, image, background subtraction, statistics, circular statistics, time-series, and SHAP — consolidated in one place. On a supported NVIDIA GPU they produce the same results as their CPU counterparts but run orders of magnitude faster on large datasets, with per-function expected-runtime tables to help you gauge the speed-up. Also includes whole-video GPU tools that decode, process and re-encode video entirely on the GPU (NVDEC -> CUDA -> NVENC): background subtraction, greyscale, CLAHE, egocentric rotation, and pose, geometry and YOLO pose overlays.
191191

192192
.. toctree::
193193
:maxdepth: 2

‎docs/simba.gpu_helpers.rst‎

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ routines — geometry, image, statistics, circular-statistics, time-series and S
1414
operations. On a supported NVIDIA GPU these run the same analyses as their CPU
1515
counterparts, but orders of magnitude faster on large datasets.
1616

17+
SimBA also has whole-video GPU tools (NVDEC decode -> CUDA -> NVENC encode) for background
18+
subtraction, greyscale, CLAHE, egocentric rotation, and pose, geometry and YOLO pose overlays;
19+
see `GPU video tools (NVDEC/NVENC)`_.
20+
1721
This page is a single consolidated view of every GPU-accelerated module. Each block
1822
is also documented in its topical section (e.g. Geometry, Statistics); the canonical,
1923
cross-referenceable entries live there, so the listings here mirror them for a
2024
one-stop GPU reference.
2125

2226
.. contents::
2327
:local:
24-
:depth: 1
28+
:depth: 2
2529

2630

2731
Geometry (GPU)
@@ -42,123 +46,136 @@ Image (GPU)
4246
:show-inheritance:
4347

4448

45-
Background subtraction (GPU)
49+
Statistics (GPU)
4650
------------------------------
47-
.. automodule:: simba.video_processors.bg_subtractor_nvenc
51+
.. automodule:: simba.data_processors.cuda.statistics
4852
:noindex:
4953
:members:
5054
:undoc-members:
5155
:show-inheritance:
5256

5357

54-
Pose plotting (GPU)
58+
Circular statistics (GPU)
5559
------------------------------
56-
.. automodule:: simba.plotting.pose_plotter_nvenc
60+
.. automodule:: simba.data_processors.cuda.circular_statistics
5761
:noindex:
5862
:members:
5963
:undoc-members:
6064
:show-inheritance:
6165

6266

63-
Greyscale conversion (GPU)
67+
Time-series statistics (GPU)
6468
------------------------------
65-
.. automodule:: simba.video_processors.greyscale_nvenc
66-
:noindex:
69+
.. automodule:: simba.data_processors.cuda.timeseries
6770
:members:
6871
:undoc-members:
6972
:show-inheritance:
7073

7174

72-
CLAHE (GPU)
75+
Feature extraction (GPU)
7376
------------------------------
74-
.. automodule:: simba.video_processors.clahe_nvenc
75-
:noindex:
77+
.. automodule:: simba.data_processors.cuda.feature_extraction
7678
:members:
7779
:undoc-members:
7880
:show-inheritance:
7981

8082

81-
Egocentric rotation (GPU)
82-
------------------------------
83-
.. automodule:: simba.video_processors.egocentric_rotator_nvenc
84-
:noindex:
83+
Feature extraction supplement (GPU)
84+
------------------------------------
85+
.. automodule:: simba.data_processors.cuda.feature_extraction_supplement
8586
:members:
8687
:undoc-members:
8788
:show-inheritance:
8889

8990

90-
Geometry overlay (GPU)
91+
SHAP explanations (GPU)
9192
------------------------------
92-
.. automodule:: simba.plotting.geometry_plotter_nvenc
93+
.. automodule:: simba.data_processors.cuda.create_shap_log
9394
:noindex:
9495
:members:
9596
:undoc-members:
9697
:show-inheritance:
9798

9899

99-
YOLO pose plotting (GPU)
100+
Data transformations (GPU)
100101
------------------------------
101-
.. automodule:: simba.plotting.yolo_pose_visualizer_nvenc
102+
.. automodule:: simba.data_processors.cuda.data
102103
:noindex:
103104
:members:
104105
:undoc-members:
105106
:show-inheritance:
106107

107108

108-
Statistics (GPU)
109+
GPU video tools (NVDEC/NVENC)
109110
------------------------------
110-
.. automodule:: simba.data_processors.cuda.statistics
111+
Whole-video tools that run every step on the GPU: frames are decoded by the NVDEC engine straight into GPU
112+
memory, processed by a CUDA kernel, and re-encoded by the NVENC engine, so the video never passes through
113+
the CPU. Each class has a CPU counterpart (linked from its documentation) and a runtime table.
114+
115+
.. note::
116+
These tools need an NVIDIA GPU and `PyNvVideoCodec <https://pypi.org/project/pynvvideocodec/>`_
117+
(``pip install pynvvideocodec==2.1.0``, the version SimBA is tested with; also in ``requirements_gpu.txt``).
118+
Background subtraction also runs without it, on a slower ffmpeg-decode + CUDA + cv2-encode path; the
119+
others raise an error. The GPU functions in the other sections of this page need only CuPy / numba.
120+
121+
122+
Background subtraction (GPU)
123+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124+
.. automodule:: simba.video_processors.bg_subtractor_nvenc
111125
:noindex:
112126
:members:
113127
:undoc-members:
114128
:show-inheritance:
115129

116130

117-
Circular statistics (GPU)
118-
------------------------------
119-
.. automodule:: simba.data_processors.cuda.circular_statistics
131+
Pose plotting (GPU)
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133+
.. automodule:: simba.plotting.pose_plotter_nvenc
120134
:noindex:
121135
:members:
122136
:undoc-members:
123137
:show-inheritance:
124138

125139

126-
Time-series statistics (GPU)
127-
------------------------------
128-
.. automodule:: simba.data_processors.cuda.timeseries
140+
Greyscale conversion (GPU)
141+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142+
.. automodule:: simba.video_processors.greyscale_nvenc
143+
:noindex:
129144
:members:
130145
:undoc-members:
131146
:show-inheritance:
132147

133148

134-
Feature extraction (GPU)
135-
------------------------------
136-
.. automodule:: simba.data_processors.cuda.feature_extraction
149+
CLAHE (GPU)
150+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151+
.. automodule:: simba.video_processors.clahe_nvenc
152+
:noindex:
137153
:members:
138154
:undoc-members:
139155
:show-inheritance:
140156

141157

142-
Feature extraction supplement (GPU)
143-
------------------------------------
144-
.. automodule:: simba.data_processors.cuda.feature_extraction_supplement
158+
Egocentric rotation (GPU)
159+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160+
.. automodule:: simba.video_processors.egocentric_rotator_nvenc
161+
:noindex:
145162
:members:
146163
:undoc-members:
147164
:show-inheritance:
148165

149166

150-
SHAP explanations (GPU)
151-
------------------------------
152-
.. automodule:: simba.data_processors.cuda.create_shap_log
167+
Geometry overlay (GPU)
168+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169+
.. automodule:: simba.plotting.geometry_plotter_nvenc
153170
:noindex:
154171
:members:
155172
:undoc-members:
156173
:show-inheritance:
157174

158175

159-
Data transformations (GPU)
160-
------------------------------
161-
.. automodule:: simba.data_processors.cuda.data
176+
YOLO pose plotting (GPU)
177+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178+
.. automodule:: simba.plotting.yolo_pose_visualizer_nvenc
162179
:noindex:
163180
:members:
164181
:undoc-members:
@@ -168,7 +185,8 @@ Data transformations (GPU)
168185
GPU utilities
169186
------------------------------
170187
Low-level CUDA device primitives (``@cuda.jit(device=True)``) that the other GPU
171-
kernels compose, plus the public NVDEC video-decoder factory.
188+
kernels compose, plus the shared NVDEC/NVENC helpers (decoder and encoder factories,
189+
decodability checks, frame timing and muxing) that the GPU video tools are built on.
172190

173191
.. automodule:: simba.data_processors.cuda.utils
174192
:members:

0 commit comments

Comments
 (0)