gst-python-ml 1.0.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/MANIFEST.in +0 -1
  2. {gst_python_ml-1.0.0/plugins/python/gst_python_ml.egg-info → gst_python_ml-1.0.2}/PKG-INFO +173 -148
  3. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/README.md +169 -146
  4. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2/plugins/python/gst_python_ml.egg-info}/PKG-INFO +173 -148
  5. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/gst_python_ml.egg-info/requires.txt +3 -1
  6. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/pyproject.toml +4 -2
  7. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/COPYING +0 -0
  8. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/__init__.py +0 -0
  9. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_aggregator.py +0 -0
  10. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_caption.py +0 -0
  11. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_classifier.py +0 -0
  12. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_llm.py +0 -0
  13. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_objectdetector.py +0 -0
  14. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_separate.py +0 -0
  15. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_transcribe.py +0 -0
  16. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_transform.py +0 -0
  17. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_translate.py +0 -0
  18. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/base_tts.py +0 -0
  19. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/caption_phi.py +0 -0
  20. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/caption_qwen.py +0 -0
  21. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/classifier.py +0 -0
  22. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/coquitts.py +0 -0
  23. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/data/soccer/app.py +0 -0
  24. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/data/soccer/botsort_people_reid.yaml +0 -0
  25. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/data/soccer/bytetrack_ball.yaml +0 -0
  26. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/demo_soccer.py +0 -0
  27. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/demucs.py +0 -0
  28. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/__init__.py +0 -0
  29. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/device_queue_pool.py +0 -0
  30. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/engine_factory.py +0 -0
  31. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/engine_manager.py +0 -0
  32. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/litert_engine.py +0 -0
  33. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/ml_engine.py +0 -0
  34. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/onnx_engine.py +0 -0
  35. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/openvino_engine.py +0 -0
  36. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/pytorch_engine.py +0 -0
  37. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/pytorch_vision_engine.py +0 -0
  38. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/engine/tensorflow_engine.py +0 -0
  39. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/gst_python_ml.egg-info/SOURCES.txt +0 -0
  40. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/gst_python_ml.egg-info/dependency_links.txt +0 -0
  41. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/gst_python_ml.egg-info/top_level.txt +0 -0
  42. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/kafkasink.py +0 -0
  43. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/llm.py +0 -0
  44. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/llm_stream_filter.py +0 -0
  45. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/log/__init__.py +0 -0
  46. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/log/global_logger.py +0 -0
  47. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/log/gst_logger.py +0 -0
  48. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/log/logger.py +0 -0
  49. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/log/logger_factory.py +0 -0
  50. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/mariantranslate.py +0 -0
  51. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/maskrcnn.py +0 -0
  52. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/objectdetector.py +0 -0
  53. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay.py +0 -0
  54. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_counter.py +0 -0
  55. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/__init__.py +0 -0
  56. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_cairo.py +0 -0
  57. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_opengl.py +0 -0
  58. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_skia.py +0 -0
  59. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_utils.py +0 -0
  60. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_utils_interface.py +0 -0
  61. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/overlay_helper/overlay_vulkan.py +0 -0
  62. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/sepformer.py +0 -0
  63. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/stablediffusion.py +0 -0
  64. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/streamdemux.py +0 -0
  65. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/streammux.py +0 -0
  66. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/__init__.py +0 -0
  67. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/analytics_utils.py +0 -0
  68. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/caption_utils.py +0 -0
  69. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/format_converter.py +0 -0
  70. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/gst_feature_manager.py +0 -0
  71. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/metadata.py +0 -0
  72. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/muxed_buffer_processor.py +0 -0
  73. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/utils/runtime_utils.py +0 -0
  74. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/video_transform.py +0 -0
  75. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/whisperlive.py +0 -0
  76. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/whisperspeechtts.py +0 -0
  77. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/whispertranscribe.py +0 -0
  78. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/plugins/python/yolo.py +0 -0
  79. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/setup.cfg +0 -0
  80. {gst_python_ml-1.0.0 → gst_python_ml-1.0.2}/tests/test_pipelines.py +0 -0
@@ -1,4 +1,3 @@
1
- include requirements.txt
2
1
  include README.md
3
2
  include COPYING
4
3
  recursive-include plugins/python *
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gst-python-ml
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: An ML package for GStreamer
5
5
  Author-email: Aaron Boxer <aaron.boxer@collabora.com>
6
6
  Project-URL: Homepage, https://github.com/collabora/gst-python-ml
@@ -18,12 +18,14 @@ Requires-Dist: transformers==4.56.2
18
18
  Requires-Dist: qwen-vl-utils[decord]==0.0.8
19
19
  Requires-Dist: autoawq==0.2.9
20
20
  Requires-Dist: accelerate==1.12.0
21
+ Requires-Dist: bitsandbytes==0.46.1
22
+ Requires-Dist: opencv-python==4.10.0.84
23
+ Requires-Dist: opencv-contrib-python==4.10.0.84
21
24
  Requires-Dist: numpy
22
25
  Requires-Dist: huggingface-hub
23
26
  Requires-Dist: lap
24
27
  Requires-Dist: pycairo
25
28
  Requires-Dist: ultralytics
26
- Requires-Dist: bitsandbytes==0.46.1
27
29
  Requires-Dist: confluent_kafka
28
30
  Requires-Dist: diffusers
29
31
  Requires-Dist: sentencepiece
@@ -56,24 +58,21 @@ Supported functionality includes:
56
58
  1. LLMs
57
59
  1. serializing model metadata to Kafka server
58
60
 
59
- ML toolkits are supported via the `MLEngine` abstraction - we have nominal support for
61
+ Different ML toolkits are supported via the `MLEngine` abstraction - we have nominal support for
60
62
  TensorFlow, LiteRT and OpenVINO, but all testing thus far has been done with PyTorch.
61
63
 
62
- These elements will work with your distribution's GStreamer packages. They have been tested on Ubuntu 24 with GStreamer 1.24.
63
-
64
- ## Python Version
65
-
66
- All elements have been tested with Python 3.12, the installed version of Python on Ubuntu 24
64
+ These elements will work with your distribution's GStreamer packages as long as the GStreamer version
65
+ is >= 1.24.
67
66
 
68
67
  ## Install
69
68
 
70
- There are two installation options described below: installing on your host machine,
71
- or installing with a Docker container:
69
+ There are two installation options described below: on host machine or on Docker container:
72
70
 
73
- ### Host Install (Ubuntu 24)
71
+ ### Host Install
74
72
 
75
- #### Install packages
73
+ #### Install distribution packages
76
74
 
75
+ ##### Ubuntu
77
76
  ```
78
77
  sudo apt update && sudo apt -y upgrade
79
78
  sudo apt install -y python3-pip python3-venv \
@@ -83,7 +82,28 @@ sudo apt install -y python3-pip python3-venv \
83
82
  libcairo2 libcairo2-dev git
84
83
  ```
85
84
 
86
- #### uv
85
+ ##### Fedora
86
+
87
+ (adjust Fedora version from 42 to match your version number)
88
+
89
+ ```
90
+ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-42.noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-42.noarch.rpm
91
+ sudo dnf update -y
92
+ sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
93
+ ```
94
+
95
+ ```
96
+ sudo dnf upgrade -y
97
+ sudo dnf install -y python3-pip \
98
+ python3-devel cairo cairo-devel cairo-gobject-devel pkgconfig git \
99
+ gstreamer1-plugins-base gstreamer1-plugins-base-tools \
100
+ gstreamer1-plugins-good gstreamer1-plugins-bad-free \
101
+ gstreamer1-plugins-bad-free-devel python3-gstreamer1
102
+ ```
103
+
104
+
105
+
106
+ #### Manage Python packages with uv
87
107
 
88
108
  ##### install
89
109
  curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -93,38 +113,31 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
93
113
  ```
94
114
  uv venv --system-site-packages
95
115
  source .venv/bin/activate
116
+ uv pip install --upgrade pip
96
117
  uv sync
97
118
  ```
98
119
 
99
120
  Now manually install flash-attn wheel (must match your version of python, torch and cuda)
100
- eg:
121
+ For example:
122
+
101
123
  `uv pip install ./flash_attn-2.8.3+cu128torch2.9-cp313-cp313-linux_x86_64.whl`
102
124
 
103
- A pre-built wheel can be found here:
125
+ Pe-built wheels can be found here:
104
126
  https://github.com/mjun0812/flash-attention-prebuild-wheels/releases
105
127
 
106
128
 
107
- #### Clone repo (host)
108
-
109
- `git clone https://github.com/collabora/gst-python-ml.git`
110
-
111
- #### Update .bashrc
129
+ #### Clone repo
112
130
 
113
131
  ```
114
- export VIRTUAL_ENV=$HOME/venv
115
- export PATH=$VIRTUAL_ENV/bin:$PATH
116
- export GST_PLUGIN_PATH=$HOME/src/gst-python-ml/plugins
132
+ cd $HOME/src
133
+ git clone https://github.com/collabora/gst-python-ml.git
117
134
  ```
118
135
 
119
- and then
120
-
121
- `source ~/.bashrc`
122
-
123
- #### Activate venv and install basic pip packages
136
+ #### Update .bashrc
124
137
 
125
138
  ```
126
- source $VIRTUAL_ENV/bin/activate
127
- pip install --upgrade pip
139
+ echo 'export GST_PLUGIN_PATH=$HOME/src/gst-python-ml/demos:$HOME/src/gst-python-ml/plugins:$GST_PLUGIN_PATH' >> ~/.bashrc
140
+ source ~/.bashrc
128
141
  ```
129
142
 
130
143
  ### Docker Install
@@ -134,7 +147,7 @@ pip install --upgrade pip
134
147
  Important Note:
135
148
 
136
149
  This Dockerfile maps a local `gst-python-ml` repository to the container,
137
- and expects this repository to be located in `~/src` i.e. `~/src/gst-python-ml`.
150
+ and expects this repository to be located in `$HOME/src` i.e. `$HOME/src/gst-python-ml`.
138
151
 
139
152
 
140
153
  #### Enable Docker GPU Support on Host
@@ -143,19 +156,12 @@ To use the host GPU in a docker container, you will need to install the nvidia c
143
156
 
144
157
 
145
158
  ##### Ubuntu
146
-
147
- Add nvidia repository
148
-
149
159
  ```
150
160
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
151
161
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
152
162
  sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
153
163
  sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
154
- ```
155
164
 
156
- Then
157
-
158
- ```
159
165
  sudo apt update
160
166
  sudo apt install -y nvidia-container-toolkit
161
167
  sudo systemctl restart docker
@@ -164,26 +170,58 @@ sudo systemctl restart docker
164
170
  ##### Fedora
165
171
 
166
172
  ```
167
- curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/
168
- nvidia-container-toolkit.repo
169
-
170
- sudo dnf install nvidia-container-toolkit
171
- sudo nvidia-ctk runtime configure --runtime=docker
172
- sudo nvidia-ctk runtime configure --runtime=containerd
173
- sudo systemctl restart containerd
174
- sudo systemctl restart docker
173
+ sudo dnf install docker
174
+ sudo usermod -aG docker $USER
175
+ # Then either log out/in completely, or:
176
+ newgrp docker
175
177
  ```
176
178
 
177
- To test:
178
179
 
179
180
  ```
180
- docker pull nvidia/cuda:12.0.0-base-ubuntu22.04
181
- docker run --rm --runtime=nvidia --gpus all nvidia/cuda:12.0.0-base-ubuntu22.04 nvidia-smi
181
+ # 1. Add NVIDIA Container Toolkit repository
182
+ curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \
183
+ sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
184
+
185
+ # 2. Remove Fedora's conflicting partial package (if present)
186
+ sudo dnf remove -y golang-github-nvidia-container-toolkit 2>/dev/null || true
187
+
188
+ # 3. Install the full NVIDIA Container Toolkit
189
+ sudo dnf install -y nvidia-container-toolkit
190
+
191
+ # 4. Configure Docker to use the NVIDIA runtime as default
192
+ sudo mkdir -p /etc/docker
193
+ sudo tee /etc/docker/daemon.json > /dev/null <<EOF
194
+ {
195
+ "runtimes": {
196
+ "nvidia": {
197
+ "path": "/usr/bin/nvidia-container-runtime",
198
+ "runtimeArgs": []
199
+ }
200
+ },
201
+ "default-runtime": "nvidia"
202
+ }
203
+ EOF
182
204
 
205
+ # 5. Fix Fedora's broken dockerd ExecStart (required!)
206
+ sudo mkdir -p /etc/systemd/system/docker.service.d
207
+ sudo tee /etc/systemd/system/docker.service.d/override.conf >/dev/null <<EOF
208
+ [Service]
209
+ ExecStart=
210
+ ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
211
+ EOF
212
+
213
+ # 6. Reload and restart Docker
214
+ sudo systemctl daemon-reload
215
+ sudo systemctl restart docker
216
+
217
+ # 7. Verify it works
218
+ docker info --format '{{.DefaultRuntime}}' # → should print: nvidia
219
+ docker run --rm --gpus all nvidia/cuda:12.0.0-base-ubuntu22.04 nvidia-smi
183
220
  ```
184
221
 
185
222
 
186
223
  #### Build Ubuntu 24.04 Container
224
+
187
225
  `docker build -f ./Dockerfile -t ubuntu24:latest .`
188
226
 
189
227
  #### Run Docker Container
@@ -194,16 +232,11 @@ b) This command assumes you have set up a Kafka network as described below
194
232
 
195
233
  `docker run -v ~/src/gst-python-ml/:/root/gst-python-ml -it --rm --gpus all --name ubuntu24 ubuntu24:latest /bin/bash`
196
234
 
197
- In the container shell, run
198
-
199
- `pip install -r requirements.txt`
200
-
201
- to install base requirements, and then
235
+ In the container shell, install `uv` following steps above
202
236
 
203
- `cd gst-python-ml` to run the pipelines below. After installing requirements,
204
- it is recommended to open another terminal on host and run
237
+ `cd gst-python-ml` to run the pipelines below.
205
238
 
206
- `docker ps` to get the container id, and then run
239
+ To persist the container, run `docker ps` to get the container id, and then run
207
240
 
208
241
  `docker commit $CONTAINER_ID` to commit the changes, where `$CONTAINER_ID`
209
242
  is the id for your docker instance.
@@ -219,15 +252,6 @@ docker image prune -a -f
219
252
 
220
253
  ## IMPORTANT NOTES
221
254
 
222
- ### Language Elements
223
-
224
- 1. To use the language elements included in this project, additional pip requirements must be installed from `requirements/language.txt`
225
-
226
- 2. A specfic version of Cuda is required for these elements: LD_LIBRARY_PATH in `~/.bashrc` must be updated with the following line (!!! adjust for your python version) :
227
-
228
- `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VIRTUAL_ENV/lib/python3.12/site-packages/nvidia/cublas/lib:$VIRTUAL_ENV/lib/python3.12/site-packages/nvidia/cudnn/lib`
229
-
230
-
231
255
  ### Birdseye
232
256
 
233
257
  To use `pyml_birdseye`, additional pip requirements must be installed from the `plugins/python/birdseye` folder.
@@ -235,7 +259,7 @@ To use `pyml_birdseye`, additional pip requirements must be installed from the `
235
259
 
236
260
  ## Post Install
237
261
 
238
- Run `gst-inspect-1.0 python` to see all of the pyml elements listed.
262
+ Run `gst-inspect-1.0 python` to list pyml elements.
239
263
 
240
264
  # Building PyPI Package
241
265
 
@@ -248,8 +272,12 @@ Run `gst-inspect-1.0 python` to see all of the pyml elements listed.
248
272
  password = FOOBAR
249
273
  ```
250
274
 
251
- 2. `pip install setuptools wheel twine`
275
+ 2.
252
276
 
277
+ ```
278
+ pip install setuptools wheel twine
279
+ pip install --upgrade build
280
+ ```
253
281
  ## Build
254
282
 
255
283
  `python -m build`
@@ -265,86 +293,6 @@ Run `gst-inspect-1.0 python` to see all of the pyml elements listed.
265
293
 
266
294
  Below are some sample pipelines for the various elements in this project.
267
295
 
268
- ### kafkasink
269
-
270
- #### Setting up kafka network
271
-
272
- `docker network create kafka-network`
273
-
274
- and list networks
275
-
276
- `docker network ls`
277
-
278
- #### docker launch
279
-
280
- To launch a docker instance with the kafka network, add ` --network kafka-network `
281
- to the docker launch command above.
282
-
283
- #### Set up kafka and zookeeper
284
-
285
- Note: setup below assumes you are running your pipeline in a docker container.
286
- If running pipeline from host, then the port changes from `9092` to `29092`,
287
- and the broker changes from `kafka` to `localhost`.
288
-
289
- ```
290
- docker stop kafka zookeeper
291
- docker rm kafka zookeeper
292
- docker run -d --name zookeeper --network kafka-network -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
293
- docker run -d --name kafka --network kafka-network \
294
- -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
295
- -e KAFKA_ADVERTISED_LISTENERS=INSIDE://kafka:9092,OUTSIDE://localhost:29092 \
296
- -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT \
297
- -e KAFKA_LISTENERS=INSIDE://0.0.0.0:9092,OUTSIDE://0.0.0.0:29092 \
298
- -e KAFKA_INTER_BROKER_LISTENER_NAME=INSIDE \
299
- -e KAFKA_BROKER_ID=1 \
300
- -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
301
- -p 9092:9092 \
302
- -p 29092:29092 \
303
- confluentinc/cp-kafka:latest
304
- ```
305
-
306
- #### Create test topic
307
- ```
308
- docker exec kafka kafka-topics --create --topic test-kafkasink-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1
309
- ```
310
-
311
- #### list topics
312
-
313
- `docker exec -it kafka kafka-topics --list --bootstrap-server kafka:9092`
314
-
315
-
316
- #### delete topic
317
-
318
- `docker exec -it kafka kafka-topics --delete --topic test-topic --bootstrap-server kafka:9092`
319
-
320
-
321
- #### consume topic
322
-
323
- `docker exec -it kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic test-kafkasink-topic --from-beginning`
324
-
325
-
326
- ### non ML
327
-
328
- `GST_DEBUG=4 gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=720 ! pyml_overlay meta-path=data/sample_metadata.json tracking=true ! videoconvert ! autovideosink`
329
-
330
- Note: make sure to set the following in `.bashrc` file :
331
-
332
- `export GST_PLUGIN_PATH=/home/$USER/src/gst-python-ml/plugins:$GST_PLUGIN_PATH`
333
-
334
-
335
- ### streammux/streamdemux pipeline
336
-
337
- ```
338
- GST_DEBUG=4 gst-launch-1.0 videotestsrc pattern=ball ! video/x-raw, width=320, height=240 ! queue ! pyml_streammux name=mux videotestsrc pattern=smpte ! video/x-raw, width=320, height=240 ! queue ! mux.sink_1 videotestsrc pattern=smpte ! video/x-raw, width=320, height=240 ! queue ! mux.sink_2 mux.src ! queue ! pyml_streamdemux name=demux demux.src_0 ! queue ! glimagesink demux.src_1 ! queue ! glimagesink demux.src_2 ! queue ! glimagesink
339
- ```
340
-
341
-
342
- ### Bird's Eye View
343
-
344
- `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videoconvert ! pyml_birdseye ! videoconvert ! autovideosink`
345
-
346
- `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! pyml_birdseye ! videoconvert ! openh264enc ! h264parse ! matroskamux ! filesink location=output.mkv`
347
-
348
296
  ### Classification
349
297
 
350
298
  ```
@@ -479,3 +427,80 @@ https://huggingface.co/models?sort=trending&search=Helsinki
479
427
  ```
480
428
  GST_DEBUG=3 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videoconvertscale ! video/x-raw,width=640,height=480 ! tee name=t t. ! queue ! textoverlay name=overlay wait-text=false ! videoconvert ! autovideosink t. ! queue leaky=2 max-size-buffers=1 ! videoconvertscale ! video/x-raw,width=240,height=180 ! pyml_caption_qwen device=cuda:0 prompt="In one sentence, describe what you see?" model-name="Qwen/Qwen2.5-VL-3B-Instruct-AWQ" name=cap cap.src ! fakesink async=0 sync=0 cap.text_src ! queue ! coalescehistory history-length=10 ! pyml_llm model-name="Qwen/Qwen3-0.6B" device=cuda system-prompt="You receive the history of what happened in recent times, summarize it nicely with excitement but NEVER mention the specific times. Focus on the most recent events." ! queue ! overlay.text_sink
481
429
  ```
430
+
431
+
432
+ ### Bird's Eye View
433
+
434
+ `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videoconvert ! pyml_birdseye ! videoconvert ! autovideosink`
435
+
436
+ `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! pyml_birdseye ! videoconvert ! openh264enc ! h264parse ! matroskamux ! filesink location=output.mkv`
437
+
438
+
439
+ ### kafkasink
440
+
441
+ #### Setting up kafka network
442
+
443
+ `docker network create kafka-network`
444
+
445
+ and list networks
446
+
447
+ `docker network ls`
448
+
449
+ #### docker launch
450
+
451
+ To launch a docker instance with the kafka network, add ` --network kafka-network `
452
+ to the docker launch command above.
453
+
454
+ #### Set up kafka and zookeeper
455
+
456
+ Note: setup below assumes you are running your pipeline in a docker container.
457
+ If running pipeline from host, then the port changes from `9092` to `29092`,
458
+ and the broker changes from `kafka` to `localhost`.
459
+
460
+ ```
461
+ docker stop kafka zookeeper
462
+ docker rm kafka zookeeper
463
+ docker run -d --name zookeeper --network kafka-network -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
464
+ docker run -d --name kafka --network kafka-network \
465
+ -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
466
+ -e KAFKA_ADVERTISED_LISTENERS=INSIDE://kafka:9092,OUTSIDE://localhost:29092 \
467
+ -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT \
468
+ -e KAFKA_LISTENERS=INSIDE://0.0.0.0:9092,OUTSIDE://0.0.0.0:29092 \
469
+ -e KAFKA_INTER_BROKER_LISTENER_NAME=INSIDE \
470
+ -e KAFKA_BROKER_ID=1 \
471
+ -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
472
+ -p 9092:9092 \
473
+ -p 29092:29092 \
474
+ confluentinc/cp-kafka:latest
475
+ ```
476
+
477
+ #### Create test topic
478
+ ```
479
+ docker exec kafka kafka-topics --create --topic test-kafkasink-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1
480
+ ```
481
+
482
+ #### list topics
483
+
484
+ `docker exec -it kafka kafka-topics --list --bootstrap-server kafka:9092`
485
+
486
+
487
+ #### delete topic
488
+
489
+ `docker exec -it kafka kafka-topics --delete --topic test-topic --bootstrap-server kafka:9092`
490
+
491
+
492
+ #### consume topic
493
+
494
+ `docker exec -it kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic test-kafkasink-topic --from-beginning`
495
+
496
+
497
+ ### non ML
498
+
499
+ `GST_DEBUG=4 gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=720 ! pyml_overlay meta-path=data/sample_metadata.json tracking=true ! videoconvert ! autovideosink`
500
+
501
+
502
+ ### streammux/streamdemux pipeline
503
+
504
+ ```
505
+ GST_DEBUG=4 gst-launch-1.0 videotestsrc pattern=ball ! video/x-raw, width=320, height=240 ! queue ! pyml_streammux name=mux videotestsrc pattern=smpte ! video/x-raw, width=320, height=240 ! queue ! mux.sink_1 videotestsrc pattern=smpte ! video/x-raw, width=320, height=240 ! queue ! mux.sink_2 mux.src ! queue ! pyml_streamdemux name=demux demux.src_0 ! queue ! glimagesink demux.src_1 ! queue ! glimagesink demux.src_2 ! queue ! glimagesink
506
+ ```