How to run the deepstream-traker-3d from the deepstream_python_apps?

• Hardware Platform (Jetson / GPU) NVIDIA GeForce RTX 4070 Laptop GPU
• DeepStream Version 7.0
• JetPack Version (valid for Jetson only)
• TensorRT Version 8.6.1.6-1+cuda12.0
• NVIDIA GPU Driver Version (valid for GPU only) 535.183.06
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I can to run the deepstream-traker-3d c version without issue. Now I need to run the application from the deepstream_python_apps. I have made the changes in the deepstream-nvdsanalytics app at deepstream_python_apps for using the deepstream-traker-3d. When a run the code, the following error occurs in the Frame Number = 62:

python3 deepstream-tracker-3d.py file:///opt/nvidia/deepstream/deepstream-7.0/sources/apps/sample_apps/deepstream_reference_apps/deepstream-tracker-3d/streams/Retail02_short.mp4

Creating Pipeline
Creating streamux
Creating source_bin 0
Creating source bin
source-bin-00
Creating Pgie
Creating nvtracker
Creating nvdsanalytics
Unknown value ‘loosue’ in for key ‘mode’ using ‘loose’
Creating tiler
Creating nvvidconv
Creating nvosd
Is it Integrated GPU? : 0
Creating EGLSink
Adding elements to Pipeline
Linking elements in the Pipeline

Now playing…

1 : file:///opt/nvidia/deepstream/deepstream-7.0/sources/apps/sample_apps/deepstream_reference_apps/deepstream-tracker-3d/streams/Retail02_short.mp4

Starting pipeline

libEGL warning: DRI3: Screen seems not DRI3 capable

libEGL warning: DRI2: failed to authenticate

gstnvtracker: Loading low-level lib at /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so

[NvMultiObjectTracker] Loading TRT Engine for tracker ReID…

[NvMultiObjectTracker] Loading Complete!

ERROR: [TRT]: 3: [runtime.cpp::~Runtime::346] Error Code 3: API Usage Error (Parameter check failed at: runtime/rt/runtime.cpp::~Runtime::346, condition: mEngineCounter.use_count() == 1. Destroying a runtime before destroying deserialized engines created by the runtime leads to undefined behavior.

)

[NvMultiObjectTracker] Initialized

0:00:04.632207359 12706 0x583a4b3cb020 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:2095> [UID = 1]: deserialized trt engine from :/home/eduardo/Downloads/deepstream_tao_apps/models/peoplenet/resnet34_peoplenet_int8.onnx_b1_gpu0_int8.engine

WARNING: [TRT]: The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.

INFO: …/nvdsinfer/nvdsinfer_model_builder.cpp:612 [Implicit Engine Info]: layers num: 3

0 INPUT kFLOAT input_1:0 3x544x960

1 OUTPUT kFLOAT output_cov/Sigmoid:0 3x34x60

2 OUTPUT kFLOAT output_bbox/BiasAdd:0 12x34x60

0:00:04.751607409 12706 0x583a4b3cb020 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2198> [UID = 1]: Use deserialized engine model: /home/eduardo/Downloads/deepstream_tao_apps/models/peoplenet/resnet34_peoplenet_int8.onnx_b1_gpu0_int8.engine

0:00:04.755647844 12706 0x583a4b3cb020 INFO nvinfer gstnvinfer_impl.cpp:343:notifyLoadModelStatus: [UID 1]: Load new model:/home/eduardo/Downloads/deepstream_tao_apps/configs/nvinfer/peoplenet_tao/config_infer_primary_peoplenet.txt sucessfully

Decodebin child added: source

Decodebin child added: decodebin0

Decodebin child added: qtdemux0

Decodebin child added: multiqueue0

Decodebin child added: h265parse0

Decodebin child added: capsfilter0

Decodebin child added: aacparse0

Decodebin child added: avdec_aac0

Decodebin child added: nvv4l2decoder0

In cb_newpad

gstname= video/x-raw

features= <Gst.CapsFeatures object at 0x6ffeb4bac400 (GstCapsFeatures at 0x6ffd34005f00)>

In cb_newpad

gstname= audio/x-raw

**PERF: {‘stream0’: 0.0}

##################################################

Objs in ROI: {‘RF’: 0}
Linecrossing Cumulative: {‘Exit’: 0, ‘Entry’: 0}
Linecrossing Current Frame: {‘Exit’: 0, ‘Entry’: 0}
Frame Number= 0 stream id= 0 Number of Objects= 0 PERSON_count= 0 BAG_count= 0 FACE_count= 0
##################################################
##################################################
Objs in ROI: {‘RF’: 0}
Linecrossing Cumulative: {‘Exit’: 0, ‘Entry’: 0}
Linecrossing Current Frame: {‘Exit’: 0, ‘Entry’: 0}
Frame Number= 1 stream id= 0 Number of Objects= 0 PERSON_count= 0 BAG_count= 0 FACE_count= 0
##################################################
##################################################
Object 1 roi status: [‘RF’]
Object 2 roi status: [‘RF’]
Object 4 roi status: [‘RF’]
Object 5 roi status: [‘RF’]
Object 6 roi status: [‘RF’]
Object 7 roi status: [‘RF’]
Object 8 roi status: [‘RF’]
Objs in ROI: {‘RF’: 7}
Linecrossing Cumulative: {‘Exit’: 0, ‘Entry’: 0}
Linecrossing Current Frame: {‘Exit’: 0, ‘Entry’: 0}
Frame Number= 2 stream id= 0 Number of Objects= 9 PERSON_count= 6 BAG_count= 0 FACE_count= 3
##################################################
.
.
.
##################################################
Object 1 roi status: [‘RF’]
Object 2 roi status: [‘RF’]
Object 0 roi status: [‘RF’]
Object 5 roi status: [‘RF’]
Object 4 roi status: [‘RF’]
Object 7 roi status: [‘RF’]
Object 6 roi status: [‘RF’]
Objs in ROI: {‘RF’: 7}
Linecrossing Cumulative: {‘Exit’: 0, ‘Entry’: 0}
Linecrossing Current Frame: {‘Exit’: 0, ‘Entry’: 0}
Frame Number= 62 stream id= 0 Number of Objects= 9 PERSON_count= 6 BAG_count= 0 FACE_count= 3
##################################################
!![Exception] [NvTrackedObjectManager::dumpTerminatedTracks()] fileTerminatedDump is not opened !!!

An exception occurred. [NvTrackedObjectManager::dumpTerminatedTracks()] fileTerminatedDump is not opened !!!

gstnvtracker: When flushing previous frames, low-level tracker lib returned error 1

##################################################

Object 1 roi status: [‘RF’]
Object 2 roi status: [‘RF’]
Object 0 roi status: [‘RF’]
Object 5 roi status: [‘RF’]
Object 4 roi status: [‘RF’]
Object 7 roi status: [‘RF’]
Object 6 roi status: [‘RF’]
Objs in ROI: {‘RF’: 7}
Linecrossing Cumulative: {‘Exit’: 0, ‘Entry’: 0}
Linecrossing Current Frame: {‘Exit’: 0, ‘Entry’: 0}
Frame Number= 63 stream id= 0 Number of Objects= 9 PERSON_count= 6 BAG_count= 0 FACE_count= 3
##################################################

Error: gst-stream-error-quark: Failed to submit input to tracker (1): gstnvtracker.cpp(792): gst_nv_tracker_submit_input_buffer (): /GstPipeline:pipeline0/GstNvTracker:tracker

Exiting app

0:00:07.351032601 12706 0x583a49d72a70 WARN nvinfer gstnvinfer.cpp:2420:gst_nvinfer_output_loop: error: Internal data stream error.

0:00:07.351059573 12706 0x583a49d72a70 WARN nvinfer gstnvinfer.cpp:2420:gst_nvinfer_output_loop: error: streaming stopped, reason error (-5)

terminate called after throwing an instance of ‘std::runtime_error’

what(): [NvTrackedObjectManager::dumpTerminatedTracks()] fileTerminatedDump is not opened !!!

Aborted (core dumped)

I really appreciate your help.

Seems the output file can’t create. Can you check if you can create the same file with C application?

Yes. With this command it works well: sudo deepstream-app -c deepstream_app_source1_3d_tracking.txt

The error log show the application can’t create the metadata dump file. I see you add sudo when run C version application. Are you also add sudo when run Python application?

Running the Python application with sudo, the following error occurs:

eduardo@eduardo:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-nvdsanalytics$ sudo python3 deepstream-tracker-3d.py file:///opt/nvidia/deepstream/deepstream-7.0/sources/apps/sample_apps/deepstream_reference_apps/deepstream-tracker-3d/streams/Retail02_short.mp4
Traceback (most recent call last):
File “/opt/nvidia/deepstream/deepstream-7.0/sources/deepstream_python_apps/apps/deepstream-nvdsanalytics/deepstream-tracker-3d.py”, line 35, in
import pyds
ModuleNotFoundError: No module named ‘pyds’

Maybe there is something wrong with the pipeline. There is only one sink for the display. Do I need to perform other sink to write the metadata?

print(“Linking elements in the Pipeline \n”)
streammux.link(queue1)
queue1.link(pgie)
pgie.link(queue2)
queue2.link(tracker)
tracker.link(queue3)
queue3.link(nvanalytics)
nvanalytics.link(queue4)
queue4.link(tiler)
tiler.link(queue5)
queue5.link(nvvidconv)
nvvidconv.link(queue6)
queue6.link(nvosd)
nvosd.link(queue7)
queue7.link(sink)

Can you have a try to disable dump tracklet by set outputTerminatedTracks to 0: deepstream_reference_apps/deepstream-tracker-3d/configs/config_tracker_NvDCF_accuracy_3D.yml at master · NVIDIA-AI-IOT/deepstream_reference_apps · GitHub?

Disabling dump tracklet, it works!
Any tip to implemet save terminated tracklets?

When enable dump tracklet, nvtracker will open one file to write the tracklet information into the file. But nvtracker failed to open the file.

Thank you @kesong.
It seams that the issue is the permission to open the file. Since I can not run the python application with sudo.
Runing the application disabling dump tracklet is enough for now. Later I will open another issue for saving the file.