gst-python-ml 0.3.0__tar.gz → 1.0.1__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 (96) hide show
  1. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/MANIFEST.in +0 -1
  2. {gst_python_ml-0.3.0/plugins/python/gst_python_ml.egg-info → gst_python_ml-1.0.1}/PKG-INFO +185 -173
  3. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/README.md +160 -133
  4. gst_python_ml-1.0.1/plugins/python/base_aggregator.py +209 -0
  5. gst_python_ml-1.0.1/plugins/python/base_caption.py +267 -0
  6. gst_python_ml-0.3.0/plugins/python/classifier_base.py → gst_python_ml-1.0.1/plugins/python/base_classifier.py +14 -18
  7. gst_python_ml-0.3.0/plugins/python/llm_base.py → gst_python_ml-1.0.1/plugins/python/base_llm.py +64 -19
  8. gst_python_ml-0.3.0/plugins/python/objectdetector_base.py → gst_python_ml-1.0.1/plugins/python/base_objectdetector.py +58 -104
  9. gst_python_ml-1.0.1/plugins/python/base_separate.py +199 -0
  10. gst_python_ml-0.3.0/plugins/python/transcribe_base.py → gst_python_ml-1.0.1/plugins/python/base_transcribe.py +44 -64
  11. gst_python_ml-1.0.1/plugins/python/base_transform.py +169 -0
  12. gst_python_ml-0.3.0/plugins/python/translate_base.py → gst_python_ml-1.0.1/plugins/python/base_translate.py +26 -47
  13. gst_python_ml-0.3.0/plugins/python/tts_base.py → gst_python_ml-1.0.1/plugins/python/base_tts.py +4 -7
  14. gst_python_ml-1.0.1/plugins/python/caption_phi.py +121 -0
  15. gst_python_ml-1.0.1/plugins/python/caption_qwen.py +124 -0
  16. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/classifier.py +4 -7
  17. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/coquitts.py +3 -3
  18. gst_python_ml-1.0.1/plugins/python/data/soccer/app.py +1390 -0
  19. gst_python_ml-1.0.1/plugins/python/data/soccer/botsort_people_reid.yaml +20 -0
  20. gst_python_ml-1.0.1/plugins/python/data/soccer/bytetrack_ball.yaml +6 -0
  21. gst_python_ml-1.0.1/plugins/python/demo_soccer.py +1897 -0
  22. gst_python_ml-1.0.1/plugins/python/demucs.py +177 -0
  23. gst_python_ml-1.0.1/plugins/python/engine/engine_factory.py +94 -0
  24. gst_python_ml-1.0.1/plugins/python/engine/engine_manager.py +87 -0
  25. gst_python_ml-1.0.1/plugins/python/engine/litert_engine.py +292 -0
  26. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/engine/ml_engine.py +24 -24
  27. gst_python_ml-1.0.1/plugins/python/engine/onnx_engine.py +318 -0
  28. gst_python_ml-1.0.1/plugins/python/engine/openvino_engine.py +275 -0
  29. gst_python_ml-1.0.1/plugins/python/engine/pytorch_engine.py +458 -0
  30. gst_python_ml-1.0.1/plugins/python/engine/pytorch_vision_engine.py +107 -0
  31. gst_python_ml-1.0.1/plugins/python/engine/tensorflow_engine.py +259 -0
  32. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1/plugins/python/gst_python_ml.egg-info}/PKG-INFO +185 -173
  33. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/gst_python_ml.egg-info/SOURCES.txt +30 -20
  34. gst_python_ml-1.0.1/plugins/python/gst_python_ml.egg-info/requires.txt +28 -0
  35. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/gst_python_ml.egg-info/top_level.txt +2 -0
  36. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/kafkasink.py +2 -2
  37. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/llm.py +3 -3
  38. gst_python_ml-1.0.1/plugins/python/llm_stream_filter.py +376 -0
  39. {gst_python_ml-0.3.0/plugins/python → gst_python_ml-1.0.1/plugins/python/log}/global_logger.py +1 -3
  40. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/mariantranslate.py +35 -3
  41. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/maskrcnn.py +3 -3
  42. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/objectdetector.py +4 -4
  43. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay.py +5 -3
  44. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_counter.py +2 -2
  45. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_skia.py +1 -1
  46. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_utils.py +0 -8
  47. gst_python_ml-1.0.1/plugins/python/sepformer.py +211 -0
  48. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/stablediffusion.py +16 -18
  49. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/streamdemux.py +1 -1
  50. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/streammux.py +1 -1
  51. gst_python_ml-1.0.1/plugins/python/utils/__init__.py +0 -0
  52. {gst_python_ml-0.3.0/plugins/python → gst_python_ml-1.0.1/plugins/python/utils}/analytics_utils.py +48 -7
  53. gst_python_ml-1.0.1/plugins/python/utils/caption_utils.py +58 -0
  54. {gst_python_ml-0.3.0/plugins/python → gst_python_ml-1.0.1/plugins/python/utils}/format_converter.py +2 -8
  55. {gst_python_ml-0.3.0/plugins/python → gst_python_ml-1.0.1/plugins/python/utils}/gst_feature_manager.py +0 -1
  56. gst_python_ml-1.0.1/plugins/python/utils/muxed_buffer_processor.py +119 -0
  57. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/video_transform.py +2 -34
  58. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/whisperlive.py +3 -8
  59. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/whisperspeechtts.py +3 -3
  60. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/whispertranscribe.py +34 -17
  61. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/yolo.py +90 -4
  62. gst_python_ml-1.0.1/pyproject.toml +68 -0
  63. gst_python_ml-0.3.0/plugins/python/aggregator_base.py +0 -218
  64. gst_python_ml-0.3.0/plugins/python/caption.py +0 -230
  65. gst_python_ml-0.3.0/plugins/python/engine/engine_factory.py +0 -128
  66. gst_python_ml-0.3.0/plugins/python/engine/litert_engine.py +0 -101
  67. gst_python_ml-0.3.0/plugins/python/engine/onnx_engine.py +0 -95
  68. gst_python_ml-0.3.0/plugins/python/engine/openvino_engine.py +0 -148
  69. gst_python_ml-0.3.0/plugins/python/engine/pytorch_engine.py +0 -321
  70. gst_python_ml-0.3.0/plugins/python/engine/pytorch_yolo_engine.py +0 -71
  71. gst_python_ml-0.3.0/plugins/python/engine/tensorflow_engine.py +0 -68
  72. gst_python_ml-0.3.0/plugins/python/gst_python_ml.egg-info/requires.txt +0 -32
  73. gst_python_ml-0.3.0/plugins/python/ml_helper.py +0 -17
  74. gst_python_ml-0.3.0/plugins/python/model_engine_helper.py +0 -78
  75. gst_python_ml-0.3.0/plugins/python/transform_base.py +0 -190
  76. gst_python_ml-0.3.0/pyproject.toml +0 -3
  77. gst_python_ml-0.3.0/requirements.txt +0 -15
  78. gst_python_ml-0.3.0/setup.py +0 -41
  79. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/COPYING +0 -0
  80. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/__init__.py +0 -0
  81. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/engine/__init__.py +0 -0
  82. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/engine/device_queue_pool.py +0 -0
  83. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/gst_python_ml.egg-info/dependency_links.txt +0 -0
  84. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/log/__init__.py +0 -0
  85. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/log/gst_logger.py +0 -0
  86. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/log/logger.py +0 -0
  87. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/log/logger_factory.py +0 -0
  88. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/__init__.py +0 -0
  89. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_cairo.py +0 -0
  90. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_opengl.py +0 -0
  91. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_utils_interface.py +0 -0
  92. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/plugins/python/overlay_helper/overlay_vulkan.py +0 -0
  93. {gst_python_ml-0.3.0/plugins/python → gst_python_ml-1.0.1/plugins/python/utils}/metadata.py +0 -0
  94. /gst_python_ml-0.3.0/plugins/python/utils.py → /gst_python_ml-1.0.1/plugins/python/utils/runtime_utils.py +0 -0
  95. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/setup.cfg +0 -0
  96. {gst_python_ml-0.3.0 → gst_python_ml-1.0.1}/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,63 +1,47 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gst-python-ml
3
- Version: 0.3.0
3
+ Version: 1.0.1
4
4
  Summary: An ML package for GStreamer
5
- Home-page: https://github.com/collabora/gst-python-ml
6
- Author: Aaron Boxer
7
- Author-email: aaron.boxer@collabora.com
8
- License: LGPL-3.0
5
+ Author-email: Aaron Boxer <aaron.boxer@collabora.com>
6
+ Project-URL: Homepage, https://github.com/collabora/gst-python-ml
9
7
  Classifier: Programming Language :: Python :: 3
10
8
  Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
11
9
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.6
10
+ Requires-Python: >=3.13
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: COPYING
15
13
  Requires-Dist: pygobject
16
- Requires-Dist: torch
17
- Requires-Dist: torchvision
18
- Requires-Dist: torchaudio
19
- Requires-Dist: transformers
14
+ Requires-Dist: torch==2.9.1
15
+ Requires-Dist: torchvision==0.24.1
16
+ Requires-Dist: torchaudio==2.9.1
17
+ Requires-Dist: transformers==4.56.2
18
+ Requires-Dist: qwen-vl-utils[decord]==0.0.8
19
+ Requires-Dist: autoawq==0.2.9
20
+ Requires-Dist: accelerate==1.12.0
21
+ Requires-Dist: bitsandbytes==0.46.1
20
22
  Requires-Dist: numpy
21
23
  Requires-Dist: huggingface-hub
22
24
  Requires-Dist: lap
23
- Requires-Dist: ultralytics
24
25
  Requires-Dist: pycairo
25
- Requires-Dist: pytest>=7.0
26
- Provides-Extra: kafka
27
- Requires-Dist: confluent-kafka; extra == "kafka"
28
- Provides-Extra: captioning
29
- Requires-Dist: ninja; extra == "captioning"
30
- Requires-Dist: flash_attn; extra == "captioning"
26
+ Requires-Dist: ultralytics
27
+ Requires-Dist: confluent_kafka
28
+ Requires-Dist: diffusers
29
+ Requires-Dist: sentencepiece
30
+ Requires-Dist: protobuf
31
+ Requires-Dist: pysilero
32
+ Requires-Dist: faster_whisper
33
+ Requires-Dist: pysilero-vad
34
+ Requires-Dist: whisperspeech
35
+ Requires-Dist: webdataset
36
+ Requires-Dist: easydict
37
+ Requires-Dist: pyflann-py3
38
+ Requires-Dist: speechbrain
31
39
  Provides-Extra: language
32
- Requires-Dist: nvidia-cudnn-cu11==8.9.6.50; extra == "language"
33
- Requires-Dist: sentencepiece; extra == "language"
34
- Requires-Dist: protobuf; extra == "language"
35
- Requires-Dist: accelerate; extra == "language"
36
- Requires-Dist: pysilero; extra == "language"
37
- Requires-Dist: faster_whisper; extra == "language"
38
- Requires-Dist: pysilero-vad; extra == "language"
39
- Requires-Dist: diffusers; extra == "language"
40
- Requires-Dist: whisperspeech; extra == "language"
41
- Requires-Dist: webdataset; extra == "language"
42
- Requires-Dist: sacremoses; extra == "language"
43
- Requires-Dist: coqui-tts; extra == "language"
44
- Dynamic: author
45
- Dynamic: author-email
46
- Dynamic: classifier
47
- Dynamic: description
48
- Dynamic: description-content-type
49
- Dynamic: home-page
50
- Dynamic: license
51
40
  Dynamic: license-file
52
- Dynamic: provides-extra
53
- Dynamic: requires-dist
54
- Dynamic: requires-python
55
- Dynamic: summary
56
41
 
57
42
  # GStreamer Python ML
58
43
 
59
- This project provides Python base classes and GStreamer elements supporting a broad range
60
- of ML features.
44
+ This project provides a pure Python ML framework for upstream GStreamer, supporting a broad range of ML vision and language features.
61
45
 
62
46
  Supported functionality includes:
63
47
 
@@ -72,24 +56,21 @@ Supported functionality includes:
72
56
  1. LLMs
73
57
  1. serializing model metadata to Kafka server
74
58
 
75
- ML toolkits are supported via the `MLEngine` abstraction - we have nominal support for
59
+ Different ML toolkits are supported via the `MLEngine` abstraction - we have nominal support for
76
60
  TensorFlow, LiteRT and OpenVINO, but all testing thus far has been done with PyTorch.
77
61
 
78
- These elements will work with your distribution's GStreamer packages. They have been tested on Ubuntu 24 with GStreamer 1.24.
79
-
80
- ## Python Version
81
-
82
- All elements have been tested with Python 3.12, the installed version of Python on Ubuntu 24
62
+ These elements will work with your distribution's GStreamer packages as long as the GStreamer version
63
+ is >= 1.24.
83
64
 
84
65
  ## Install
85
66
 
86
- There are two installation options described below: installing on your host machine,
87
- or installing with a Docker container:
67
+ There are two installation options described below: on host machine or on Docker container:
88
68
 
89
- ### Host Install (Ubuntu 24)
69
+ ### Host Install
90
70
 
91
- #### Install packages
71
+ #### Install distribution packages
92
72
 
73
+ ##### Ubuntu
93
74
  ```
94
75
  sudo apt update && sudo apt -y upgrade
95
76
  sudo apt install -y python3-pip python3-venv \
@@ -99,39 +80,52 @@ sudo apt install -y python3-pip python3-venv \
99
80
  libcairo2 libcairo2-dev git
100
81
  ```
101
82
 
102
- #### Install venv
83
+ ##### Fedora
84
+ ```
85
+ sudo dnf upgrade -y
86
+ sudo dnf install -y python3-pip \
87
+ gstreamer1-plugins-base gstreamer1-plugins-base-tools \
88
+ gstreamer1-plugins-good gstreamer1-plugins-bad-free \
89
+ gstreamer1-plugins-bad-free-devel python3-gstreamer1 \
90
+ cairo cairo-devel git
91
+ ```
103
92
 
104
- `python3 -m venv --system-site-packages ~/venv`
105
93
 
106
94
 
107
- #### Clone repo (host)
95
+ #### Manage Python packages with uv
108
96
 
109
- `git clone https://github.com/collabora/gst-python-ml.git`
97
+ ##### install
98
+ curl -LsSf https://astral.sh/uv/install.sh | sh
110
99
 
111
- #### Update .bashrc
100
+ ##### set up uv venv
112
101
 
113
102
  ```
114
- export VIRTUAL_ENV=$HOME/venv
115
- export PATH=$VIRTUAL_ENV/bin:$PATH
116
- export GST_PLUGIN_PATH=$HOME/src/gst-python-ml/plugins
103
+ uv venv --system-site-packages
104
+ source .venv/bin/activate
105
+ uv sync
117
106
  ```
118
107
 
119
- and then
108
+ Now manually install flash-attn wheel (must match your version of python, torch and cuda)
109
+ For example:
110
+
111
+ `uv pip install ./flash_attn-2.8.3+cu128torch2.9-cp313-cp313-linux_x86_64.whl`
112
+
113
+ Pe-built wheels can be found here:
114
+ https://github.com/mjun0812/flash-attention-prebuild-wheels/releases
120
115
 
121
- `source ~/.bashrc`
122
116
 
123
- #### Activate venv and install basic pip packages
117
+ #### Clone repo
124
118
 
125
119
  ```
126
- source $VIRTUAL_ENV/bin/activate
127
- pip install --upgrade pip
120
+ cd $HOME/src
121
+ git clone https://github.com/collabora/gst-python-ml.git
128
122
  ```
129
123
 
130
- #### Install pip requirements
124
+ #### Update .bashrc
131
125
 
132
126
  ```
133
- cd ~/src/gst-python-ml
134
- pip install -r requirements.txt
127
+ echo 'export GST_PLUGIN_PATH=$HOME/src/gst-python-ml/plugins:$GST_PLUGIN_PATH' >> ~/.bashrc
128
+ source ~/.bashrc
135
129
  ```
136
130
 
137
131
  ### Docker Install
@@ -141,7 +135,7 @@ pip install -r requirements.txt
141
135
  Important Note:
142
136
 
143
137
  This Dockerfile maps a local `gst-python-ml` repository to the container,
144
- and expects this repository to be located in `~/src` i.e. `~/src/gst-python-ml`.
138
+ and expects this repository to be located in `$HOME/src` i.e. `$HOME/src/gst-python-ml`.
145
139
 
146
140
 
147
141
  #### Enable Docker GPU Support on Host
@@ -149,43 +143,56 @@ and expects this repository to be located in `~/src` i.e. `~/src/gst-python-ml`
149
143
  To use the host GPU in a docker container, you will need to install the nvidia container toolkit. If running on CPU, these steps can be skipped.
150
144
 
151
145
 
152
- Add nvidia repository (Ubuntu)
153
-
146
+ ##### Ubuntu
154
147
  ```
155
148
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
156
149
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
157
150
  sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
158
151
  sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
159
- ```
160
152
 
161
- Then
162
-
163
- ```
164
153
  sudo apt update
165
154
  sudo apt install -y nvidia-container-toolkit
166
155
  sudo systemctl restart docker
167
156
  ```
168
157
 
158
+ ##### Fedora
159
+ ```
160
+ curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/
161
+ nvidia-container-toolkit.repo
162
+
163
+ sudo dnf install nvidia-container-toolkit
164
+ sudo nvidia-ctk runtime configure --runtime=docker
165
+ sudo nvidia-ctk runtime configure --runtime=containerd
166
+ sudo systemctl restart containerd
167
+ sudo systemctl restart docker
168
+ ```
169
+
170
+ ##### Testing GPU Support
171
+
172
+ ```
173
+ docker pull nvidia/cuda:12.0.0-base-ubuntu22.04
174
+ docker run --rm --runtime=nvidia --gpus all nvidia/cuda:12.0.0-base-ubuntu22.04 nvidia-smi
175
+
176
+ ```
177
+
178
+
169
179
  #### Build Ubuntu 24.04 Container
180
+
170
181
  `docker build -f ./Dockerfile -t ubuntu24:latest .`
171
182
 
172
183
  #### Run Docker Container
173
184
 
174
185
  a) If running on CPU, just remove `--gpus all` from command below
186
+
175
187
  b) This command assumes you have set up a Kafka network as described below
176
188
 
177
189
  `docker run -v ~/src/gst-python-ml/:/root/gst-python-ml -it --rm --gpus all --name ubuntu24 ubuntu24:latest /bin/bash`
178
190
 
179
- In the container shell, run
191
+ In the container shell, install `uv` following steps above
180
192
 
181
- `pip install -r requirements.txt`
193
+ `cd gst-python-ml` to run the pipelines below.
182
194
 
183
- to install base requirements, and then
184
-
185
- `cd gst-python-ml` to run the pipelines below. After installing requirements,
186
- it is recommended to open another terminal on host and run
187
-
188
- `docker ps` to get the container id, and then run
195
+ To persist the container, run `docker ps` to get the container id, and then run
189
196
 
190
197
  `docker commit $CONTAINER_ID` to commit the changes, where `$CONTAINER_ID`
191
198
  is the id for your docker instance.
@@ -199,15 +206,16 @@ docker container prune -f
199
206
  docker image prune -a -f
200
207
  ```
201
208
 
202
- ## IMPORTANT NOTE
209
+ ## IMPORTANT NOTES
210
+
211
+ ### Birdseye
212
+
213
+ To use `pyml_birdseye`, additional pip requirements must be installed from the `plugins/python/birdseye` folder.
203
214
 
204
- To use the language elements included in this project, the `nvidia-cuda-toolkit`
205
- ubuntu package must be installed, and additional pip requirements must be installed from
206
- `requirements/language_requrements.txt`
207
215
 
208
216
  ## Post Install
209
217
 
210
- Run `gst-inspect-1.0 python` to see all of the pyml elements listed.
218
+ Run `gst-inspect-1.0 python` to list pyml elements.
211
219
 
212
220
  # Building PyPI Package
213
221
 
@@ -237,79 +245,6 @@ Run `gst-inspect-1.0 python` to see all of the pyml elements listed.
237
245
 
238
246
  Below are some sample pipelines for the various elements in this project.
239
247
 
240
- ### kafkasink
241
-
242
- #### Setting up kafka network
243
-
244
- `docker network create kafka-network`
245
-
246
- and list networks
247
-
248
- `docker network ls`
249
-
250
- #### docker launch
251
-
252
- To launch a docker instance with the kafka network, add ` --network kafka-network `
253
- to the docker launch command above.
254
-
255
- #### Set up kafka and zookeeper
256
-
257
- Note: setup below assumes you are running your pipeline in a docker container.
258
- If running pipeline from host, then the port changes from `9092` to `29092`,
259
- and the broker changes from `kafka` to `localhost`.
260
-
261
- ```
262
- docker stop kafka zookeeper
263
- docker rm kafka zookeeper
264
- docker run -d --name zookeeper --network kafka-network -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
265
- docker run -d --name kafka --network kafka-network \
266
- -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
267
- -e KAFKA_ADVERTISED_LISTENERS=INSIDE://kafka:9092,OUTSIDE://localhost:29092 \
268
- -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT \
269
- -e KAFKA_LISTENERS=INSIDE://0.0.0.0:9092,OUTSIDE://0.0.0.0:29092 \
270
- -e KAFKA_INTER_BROKER_LISTENER_NAME=INSIDE \
271
- -e KAFKA_BROKER_ID=1 \
272
- -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
273
- -p 9092:9092 \
274
- -p 29092:29092 \
275
- confluentinc/cp-kafka:latest
276
- ```
277
-
278
- #### Create test topic
279
- ```
280
- docker exec kafka kafka-topics --create --topic test-kafkasink-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1
281
- ```
282
-
283
- #### list topics
284
-
285
- `docker exec -it kafka kafka-topics --list --bootstrap-server kafka:9092`
286
-
287
-
288
- #### delete topic
289
-
290
- `docker exec -it kafka kafka-topics --delete --topic test-topic --bootstrap-server kafka:9092`
291
-
292
-
293
- #### consume topic
294
-
295
- `docker exec -it kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic test-kafkasink-topic --from-beginning`
296
-
297
-
298
- ### non ML
299
-
300
- `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`
301
-
302
- Note: make sure to set the following in `.bashrc` file :
303
-
304
- `export GST_PLUGIN_PATH=/home/$USER/src/gst-python-ml/plugins:$GST_PLUGIN_PATH`
305
-
306
-
307
- ### Bird's Eye View
308
-
309
- `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videoconvert ! pyml_birdseye ! videoconvert ! autovideosink`
310
-
311
- `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`
312
-
313
248
  ### Classification
314
249
 
315
250
  ```
@@ -366,17 +301,10 @@ GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_tracking.mp4 ! decodeb
366
301
 
367
302
  ```
368
303
 
369
- #### yolo with overlay
370
-
371
304
  ```
372
- GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_tracking.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! pyml_yolo model-name=yolo11m device=cuda:0 track=True ! pyml_overlay ! videoconvert ! autovideosink
305
+ GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_tracking.mp4 ! decodebin ! videoconvertscale ! video/x-raw,width=640,height=480 ! demo_soccer model-name=yolo11m device=cuda:0 ! pyml_overlay ! videoconvert ! autovideosink
373
306
  ```
374
307
 
375
- ### streammux/streamdemux pipeline
376
-
377
- ```
378
- 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
379
- ```
380
308
 
381
309
  ### Transcription
382
310
 
@@ -392,6 +320,14 @@ GST_DEBUG=4 gst-launch-1.0 filesrc location=data/air_traffic_korean_with_english
392
320
  GST_DEBUG=4 gst-launch-1.0 filesrc location=data/air_traffic_korean_with_english.wav ! decodebin ! audioconvert ! pyml_whispertranscribe device=cuda language=ko translate=yes ! fakesink
393
321
  ```
394
322
 
323
+ #### demucs audio separation
324
+
325
+
326
+ ```
327
+ GST_DEBUG=4 gst-launch-1.0 filesrc location=data/air_traffic_korean_with_english.wav ! decodebin ! audioconvert ! audioresample ! pyml_demucs device=cuda ! wavenc ! filesink location=separated_vocals.wav
328
+ ```
329
+
330
+
395
331
  #### coquitts
396
332
 
397
333
  ```
@@ -436,11 +372,87 @@ https://huggingface.co/models?sort=trending&search=Helsinki
436
372
 
437
373
  #### Caption
438
374
 
439
- #### caption + yolo
375
+ #### caption qwen with history
376
+
377
+ (should also work with "microsoft/Phi-3.5-vision-instruct" model)
378
+
379
+ ```
380
+ 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
381
+ ```
382
+
383
+
384
+ ### Bird's Eye View
385
+
386
+ `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_single_camera.mp4 ! decodebin ! videoconvert ! pyml_birdseye ! videoconvert ! autovideosink`
387
+
388
+ `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`
389
+
390
+
391
+ ### kafkasink
392
+
393
+ #### Setting up kafka network
394
+
395
+ `docker network create kafka-network`
440
396
 
441
- `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_tracking.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! pyml_yolo model-name=yolo11m device=cuda:0 track=True ! pyml_caption device=cuda:0 ! textoverlay ! pyml_overlay ! videoconvert ! autovideosink`
397
+ and list networks
398
+
399
+ `docker network ls`
400
+
401
+ #### docker launch
402
+
403
+ To launch a docker instance with the kafka network, add ` --network kafka-network `
404
+ to the docker launch command above.
442
405
 
406
+ #### Set up kafka and zookeeper
443
407
 
444
- #### caption
408
+ Note: setup below assumes you are running your pipeline in a docker container.
409
+ If running pipeline from host, then the port changes from `9092` to `29092`,
410
+ and the broker changes from `kafka` to `localhost`.
445
411
 
446
- `GST_DEBUG=4 gst-launch-1.0 filesrc location=data/soccer_tracking.mp4 ! decodebin ! videoconvert ! pyml_caption device=cuda:0 downsampled_width=320 downsampled_height=240 prompt="What is the name of the game being played?" ! textoverlay ! autovideosink`
412
+ ```
413
+ docker stop kafka zookeeper
414
+ docker rm kafka zookeeper
415
+ docker run -d --name zookeeper --network kafka-network -e ZOOKEEPER_CLIENT_PORT=2181 confluentinc/cp-zookeeper:latest
416
+ docker run -d --name kafka --network kafka-network \
417
+ -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
418
+ -e KAFKA_ADVERTISED_LISTENERS=INSIDE://kafka:9092,OUTSIDE://localhost:29092 \
419
+ -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT \
420
+ -e KAFKA_LISTENERS=INSIDE://0.0.0.0:9092,OUTSIDE://0.0.0.0:29092 \
421
+ -e KAFKA_INTER_BROKER_LISTENER_NAME=INSIDE \
422
+ -e KAFKA_BROKER_ID=1 \
423
+ -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
424
+ -p 9092:9092 \
425
+ -p 29092:29092 \
426
+ confluentinc/cp-kafka:latest
427
+ ```
428
+
429
+ #### Create test topic
430
+ ```
431
+ docker exec kafka kafka-topics --create --topic test-kafkasink-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1
432
+ ```
433
+
434
+ #### list topics
435
+
436
+ `docker exec -it kafka kafka-topics --list --bootstrap-server kafka:9092`
437
+
438
+
439
+ #### delete topic
440
+
441
+ `docker exec -it kafka kafka-topics --delete --topic test-topic --bootstrap-server kafka:9092`
442
+
443
+
444
+ #### consume topic
445
+
446
+ `docker exec -it kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic test-kafkasink-topic --from-beginning`
447
+
448
+
449
+ ### non ML
450
+
451
+ `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`
452
+
453
+
454
+ ### streammux/streamdemux pipeline
455
+
456
+ ```
457
+ 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
458
+ ```