Please provide complete information as applicable to your setup.
**• Hardware Platform - GPU
**• DeepStream Version 6.2
**• NVIDIA GPU Driver Version 530.41.03
**• Issue Type( questions, new requirements, bugs) - Python codelet is not working
**• How to reproduce the issue? Try to run the code as specified in the web page and there is no output.
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
I have added a Python codelet V0 to the Deepstream Test1 app and linked the Python codelet to the block.
The manifest file was created by running the graph composer and it was created before inserting the Python codelet block.
The Python file was the default file without any changes. The file with all default functions like start, stop, etc., and all functions are empty.
I followed all the steps exactly as specified in the below website:
https://docs.nvidia.com/metropolis/deepstream/dev-guide/graphtools-docs/docs/text/ExtensionsManual/Python_Codelet.html
- Installed extensions using
registry graph install -g path/to/graph.yaml -m output/path/to/generated/manifest.yaml -d path/to/target.yaml --output-directory output/directory
- Copied the extensions using
cp -r /opt/nvidia/graph-composer/core output/directory/gxf
- Added path using
export PYTHONPATH=output/directory
- Run the graph using
python3 output/directory/gxf/std/gxe.py --app path/to/graph.yaml --manifest path/to/manifest/file.yaml
The output is as below:
(composer) ai-rtx3080@ai-rtx3080:~$ python3 /home/ai-rtx3080/Documents/composer_python_output_directory4/gxf/std/gxe.py --app /home/ai-rtx3080/Documents/reference_graphs/deepstream-test1-v3/deepstream-test1.yaml --manifest /tmp/ds.deepstream-test1/manifest.yaml
creating context…
loading extensions…
loading graph file…
2023-06-28 17:42:19.323 INFO gxf/std/yaml_file_loader.cpp@129: Loading GXF entities from YAML file ‘/home/ai-rtx3080/Documents/reference_graphs/deepstream-test1-v3/deepstream-test1.yaml’…
activating graph…
2023-06-28 17:42:19.461 INFO extensions/nvdsbase/nvds_scheduler.cpp@270: This program is linked against GStreamer 1.18.2
There is no output after this and I assume that the graph is not running.
Please help me to resolve the issue.
Thank you.
Can you post your python codelet and the graph for us to reproduce the failure?
Thank you for your response.
I used the Deepstream-test1 app as supplied. I changed the video input stream. I run the application from the graph composer and worked fine.
I added a PycodeletV0 block and updated the codelet_name and codelet_file properties.
Python codelet is as below:
“”"
SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
“”"
from gxf.std import MemoryStorageType
from gxf.cuda import CudaStreamPool
from gxf.python_codelet import PyCodeletV0
from gxf.std import Clock
from gxf.std import Allocator
from gxf.std import Receiver
from gxf.std import Transmitter
import yaml
class CodeletAdapter:
“”" Base class that users implement for a python codelet.
This class is the brige for C++ application and the python codelet.
Contains helper functions to access codelet parameters.
“”"
def set_bridge(self, bridge):
self.bridge = bridge
def context(self):
return self.bridge.context()
def eid(self):
return self.bridge.eid()
def cid(self):
return self.bridge.cid()
def name(self):
return self.bridge.name()
def get_execution_timestamp(self):
return self.bridge.get_execution_timestamp()
def get_execution_time(self):
return self.bridge.get_execution_time()
def get_delta_time(self):
return self.bridge.get_delta_time()
def get_execution_count(self):
return self.bridge.get_execution_count()
def is_first_tick(self):
return self.bridge.is_first_tick()
def get_params(self):
return yaml.safe_load(self.bridge.get_params())
def tick(self):
pass
def start(self):
pass
def stop(self):
pass
Once again, thank you and look forward to seeing your response.
Regards,
P. Gnanavelu
Can you post your graph YAML file too?
Hi Fiona Chen,
Thank you for the reply and please find the yaml file as requested.
application:
name: deepstream-test1
dependencies:
- extension: NvDsSourceExt
uuid: a632d022-3425-4848-9074-e6483ef74366
version: 1.1.1
- extension: NvDsBaseExt
uuid: 56d7e3ec-62c6-4652-bcc8-4f1c3b00df03
version: 1.2.0
- extension: NvDsMuxDemuxExt
uuid: 89b8398c-5820-4051-835c-a91f2d49766b
version: 1.1.0
- extension: NvDsInferenceExt
uuid: 0b02963e-c24e-4c13-ace0-c4cdf36c7c71
version: 1.1.0
- extension: NvDsSampleModelsExt
uuid: 909dc1ea-c654-44c1-97a3-0b8fec12141a
version: 1.1.0
- extension: NvDsVisualizationExt
uuid: 25903cd4-fc5c-4139-987b-47bb27e8b424
version: 1.1.0
- extension: NvDsOutputSinkExt
uuid: 3fc9ad87-03e7-47a8-bbfc-8501c3f7ff2f
version: 1.1.0
- extension: NvDsInferenceUtilsExt
uuid: 27856a43-5ad4-4d8e-be36-0ec2cf9bbb58
version: 1.1.1
- extension: PythonCodeletExtension
uuid: 787daddc-1c34-11ec-9621-0242ac130002
version: 0.1.0
components:
- name: single_source_input
parameters:
audio-out-%u: audio_output
uri: rtsp://XXXX:[email protected]:554/profile2/media.smp
video-out-%u: video_output
type: nvidia::deepstream::NvDsSingleSrcInput
- name: audio_output
type: nvidia::deepstream::NvDsDynamicOutput
- name: video_output
type: nvidia::deepstream::NvDsDynamicOutput
name: single_source_input
ui_property:
position:
x: -192.76365661621094
y: -21.535430908203125
state: 0
components:
- name: streammux
parameters:
batch-size: 1
height: 1080
video-in-%u: video_input
video-out: video_output
width: 1920
type: nvidia::deepstream::NvDsStreamMux
- name: video_input
type: nvidia::deepstream::NvDsOnRequestInput
- name: video_output
type: nvidia::deepstream::NvDsStaticOutput
name: streammux
ui_property:
position:
x: 98.1181869506836
y: 2.1889781951904297
state: 0
components:
- name: nv_ds_connection9..7978
parameters:
source: single_source_input/video_output
target: streammux/video_input
type: nvidia::deepstream::NvDsConnection
name: node..3ba8
components:
- name: object_detector
parameters:
infer-model-config: resnet10_4_class_detector
video-in: video_input
video-out: video_output
type: nvidia::deepstream::NvDsInferVideo
- name: video_input
type: nvidia::deepstream::NvDsStaticInput
- name: video_output
type: nvidia::deepstream::NvDsStaticOutput
- name: resnet10_4_class_detector
type: nvidia::deepstream::NvDsResnet10_4ClassDetectorModel
name: object_detector
ui_property:
position:
x: 346.7088317871094
y: -12.25196647644043
state: 0
components:
- name: nv_ds_connection13..5e10
parameters:
source: streammux/video_output
target: object_detector/video_input
type: nvidia::deepstream::NvDsConnection
name: node..7c18
components:
- name: onscreen_display
parameters:
video-in: video_input
video-out: video_output
type: nvidia::deepstream::NvDsOSD
- name: video_input
type: nvidia::deepstream::NvDsStaticInput
- name: video_output
type: nvidia::deepstream::NvDsStaticOutput
name: onscreen_display
ui_property:
position:
x: 624.1812744140625
y: 12.503938674926758
state: 0
components:
- name: nv_ds_connection17..ac88
parameters:
source: object_detector/video_output
target: onscreen_display/video_input
type: nvidia::deepstream::NvDsConnection
name: node..aeb8
components:
- name: video_renderer
parameters:
video-in: video_input
type: nvidia::deepstream::NvDsVideoRenderer
- name: video_input
type: nvidia::deepstream::NvDsStaticInput
name: video_renderer
ui_property:
position:
x: 897.5277099609375
y: 29.007875442504883
state: 0
components:
- name: nv_ds_connection20..5160
parameters:
source: onscreen_display/video_output
target: video_renderer/video_input
type: nvidia::deepstream::NvDsConnection
name: node..9b00
components:
- name: per_class_object_counting
parameters:
probe-connector: probe_connector
type: nvidia::deepstream::NvDsPerClassObjectCounting
- name: probe_connector
type: nvidia::deepstream::NvDsProbeConnector
name: per_class_object_counting
ui_property:
position:
x: 625.21240234375
y: 272.44097900390625
state: 0
components:
- name: nv_ds_probe1..5be0
parameters:
io: object_detector/video_output
probe-connector: per_class_object_counting/probe_connector
type: nvidia::deepstream::NvDsProbe
name: node..3400
components:
- name: scheduler
type: nvidia::deepstream::NvDsScheduler
name: scheduler
ui_property:
position:
x: 52.7322883605957
y: 297.19696044921875
state: 0
components:
- name: py_codelet_v00
parameters:
codelet_file: /home/ai-rtx3080/Documents/composer_python_output_directory2/gxf/python_codelet/codelet.py
codelet_name: codelet.py
type: nvidia::gxf::PyCodeletV0
name: PyCodeletV0
ui_property:
position:
x: 580.9165649414062
y: 424.2505798339844
Hi,
I look forward to seeing your response.
Thank you.
Same here as we are facing a similar error.