Action Recognition on Dynamic ROIs fails with CUDA error

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only) 5.1.1
• TensorRT Version 8.5.2.2
• NVIDIA GPU Driver Version (valid for GPU only) N/A
• Issue Type( questions, new requirements, bugs) Question/Bug
• 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) See below for details
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description) N/A

I have an action recognition model performing inference on ROIs. It works great on pre-configured ROIs. In my environment they change location infrequently. This is a problem for me because I have to restart the app with a different set of ROIs configured in order to make it work. I want to make the app more robust, so I have been looking to make the ROIs dynamic.

To achieve this goal I’ve added a detector running at a high interval, 18k frames (10 minutes or so at 30FPS) and a tracker to keep the boxes alive when the detector is not running. It works great for a few intervals, but unfortunately when the detector runs, it can sometimes make the nvdspreprocess element fail with a generic CUDA error.

/.../sequence_image_process.cpp:312, [ERROR: CUSTOM_LIB] Failed to copy ready sequence to batched buffer, cuda err_no: 1, err_str: cudaErrorInvalidValue
/.../sequence_image_process.cpp:654, [ERROR: CUSTOM_LIB] collect ready buffers failed, seq_process error: 7

I suspect this is due to the sequence_image_process library does not handle ROIs changing over time. Is this a known issue or something that can be addressed?

My simplified pipeline looks like this:

N sources > nvstreammux > nvinfer > nvtracker > nvdspreprocess > nvinfer > sink

Relevant configurations for the elements above:

  • primary detector
[property]
interval=749
gie-unique-id=2
process-mode=1
network-type=0
# (...)
  • tracker is NvDCF
  • preprocess configuration
[property]
enable=1
process-on-frame=0
target-unique-ids=5
processing-width=224
processing-height=224
network-input-shape=32;3;16;224;224
# (...)
[user-configs]
subsample=19
stride=8
# (...)
  • action recognition configuration
[property]
gie-unique-id=5
process-mode=2
input-tensor-from-meta=1
network-type=100
# (...)

Unfortunately I cannot provide the full source code or input data, but from my testing it is fairly consistent to get it to fail after around two detection intervals (in the configuration above, roughly around 1500 frames)

Based on your error printing, this seems to be a memory issue. Could you capture the HW & SW Memory Leak log by referring the link: https://forums.developer.nvidia.com/t/deepstream-sdk-faq/80236/14

Sure, attaching it.

vmemstat.txt (33.3 KB)

It’s weird that the hardware memory is 0. Which specific Jetson are you using, Orin , Xaviar…?
Could you reproduce the problem in our demo code: `sources\apps\sample_apps\deepstream-3d-action-recognition?
How do you start and stop the detector during the pipeline running?

This is all running on a Jetson AGX Orin.

I technically do not stop and start the detector, I have it configured with a high interval, so it inherently runs at low frequency (see snippet from configuration file above)

I’ll modify the sample and provide the diff to reproduce. It might take me a bit.

I am not able to get the CUDA error on the modified 3d-action-recognition sample. The app processes a few intervals and then hangs indefinitely. I do not know if it’s related.

I have modified the sample using nvidia models and input data only. This is running on NVIDIA’s nvcr.io/nvidia/deepstream-l4t:6.2-triton container. In order to test, please download the attached patch file to the root of sources\apps\sample_apps\deepstream-3d-action-recognition.

patch (19.1 KB)

Then run the following lines:

patch -p1 < patch
bash download_models.sh
export CUDA_VER=11.4
unset DISPLAY
make install
./deepstream-3d-action-recognition -c deepstream_action_recognition_config.txt

The app hangs for me at frame 350 after displaying the following messages are displayed:

...
[DEBUG: DS_3DAR] Infer done for frame 350, number of objects: 5
sequence_image_process.cpp:685, [DEBUG: CUSTOM_LIB] CustomSequenceTensorPreparation processing in progress
sequence_image_process.cpp:610, [DEBUG: CUSTOM_LIB] preparing sequence TensorData in progress...
sequence_image_process.cpp:627, [DEBUG: CUSTOM_LIB] preparing sequence tensor data received 4 rois
sequence_image_process.cpp:191, [DEBUG: CUSTOM_LIB] Adding new ROI of source: 0 mapped to dst blockId: 7, offset:2, total ROI numbers: 31
sequence_image_process.cpp:191, [DEBUG: CUSTOM_LIB] Adding new ROI of source: 0 mapped to dst blockId: 7, offset:3, total ROI numbers: 32
nvmemstat capture
PID: 441119   16:40:18  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 32290.6875 MiB  VmRSS: 529.2070 MiB     RssFile: 234.4570 MiB   RssAnon: 299.1328 MiB   lsof: 0
PID: 441119   16:40:19  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 32531.0430 MiB  VmRSS: 846.1875 MiB     RssFile: 393.1484 MiB   RssAnon: 456.5352 MiB   lsof: 0
PID: 441119   16:40:20  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 33580.0547 MiB  VmRSS: 919.8320 MiB     RssFile: 305.6914 MiB   RssAnon: 614.1406 MiB   lsof: 0
PID: 441119   16:40:21  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 33580.0547 MiB  VmRSS: 1089.1719 MiB    RssFile: 475.9844 MiB   RssAnon: 614.1719 MiB   lsof: 0
PID: 441119   16:40:22  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34632.5234 MiB  VmRSS: 945.8906 MiB     RssFile: 301.2422 MiB   RssAnon: 644.6484 MiB   lsof: 0
PID: 441119   16:40:23  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34632.5234 MiB  VmRSS: 946.1484 MiB     RssFile: 301.2422 MiB   RssAnon: 644.9062 MiB   lsof: 0
PID: 441119   16:40:24  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 946.8320 MiB     RssFile: 301.5859 MiB   RssAnon: 645.2461 MiB   lsof: 0
PID: 441119   16:40:25  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 946.8320 MiB     RssFile: 301.5859 MiB   RssAnon: 645.2461 MiB   lsof: 0
PID: 441119   16:40:26  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 946.8320 MiB     RssFile: 301.5859 MiB   RssAnon: 645.2461 MiB   lsof: 0
PID: 441119   16:40:27  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.0898 MiB     RssFile: 301.5859 MiB   RssAnon: 645.5039 MiB   lsof: 0
PID: 441119   16:40:28  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.6016 MiB     RssFile: 302.0312 MiB   RssAnon: 645.5703 MiB   lsof: 0
PID: 441119   16:40:29  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.6016 MiB     RssFile: 302.0312 MiB   RssAnon: 645.5703 MiB   lsof: 0
PID: 441119   16:40:30  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.9102 MiB     RssFile: 302.3203 MiB   RssAnon: 645.5898 MiB   lsof: 0
PID: 441119   16:40:31  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.9102 MiB     RssFile: 302.3203 MiB   RssAnon: 645.5898 MiB   lsof: 0
PID: 441119   16:40:32  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 947.9102 MiB     RssFile: 302.3203 MiB   RssAnon: 645.5898 MiB   lsof: 0
PID: 441119   16:40:33  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.4258 MiB     RssFile: 302.8203 MiB   RssAnon: 645.6055 MiB   lsof: 0
PID: 441119   16:40:34  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.4258 MiB     RssFile: 302.8203 MiB   RssAnon: 645.6055 MiB   lsof: 0
PID: 441119   16:40:35  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.4258 MiB     RssFile: 302.8203 MiB   RssAnon: 645.6055 MiB   lsof: 0
PID: 441119   16:40:36  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.4258 MiB     RssFile: 302.8203 MiB   RssAnon: 645.6055 MiB   lsof: 0
PID: 441119   16:40:37  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:38  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:40  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:41  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:42  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:43  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:44  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:45  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:46  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:47  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:48  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:49  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:50  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:51  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:52  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:53  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:54  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:55  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:56  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:57  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:58  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:40:59  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:00  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:01  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:02  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:03  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:04  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:05  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:07  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:08  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:09  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:10  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:11  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:12  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:13  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:14  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:15  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:16  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:17  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:18  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0
PID: 441119   16:41:19  Total used hardware memory: 0.0000 KiB  hardware memory: 0.0000 KiB             VmSize: 34636.2344 MiB  VmRSS: 948.6172 MiB     RssFile: 302.9453 MiB   RssAnon: 645.6719 MiB   lsof: 0


This scenario is not the same as your actual application scenario, as the ROI in the config file of preprocess will not change in this scenario.
Could you try to use gst_nvevent_new_roi_update API to change the ROI when you needed?

Just to clarify: the ROI in the configuration file is not used, because the action recognition model is working as sgie (process-mode=2). ROI updates are provided by the detector-tracker. The pipeline in the modified sample is:
nvstreammux > nvinfer > nvtracker > nvdspreprocess > nvinfer > sink.

Are you suggesting I should change the pipeline to drop the detector and tracker and update the ROIs manually?

I believe the source of the pipeline hanging is in this line (3rd party mirror of DS sources) which uses default parameters for that function. This means it will block if the pool is empty. If I pass GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT to the function I can get an error instead. Does the custom sequence library handle ROI updates? It looks like it only adds ROIs, but does not remove them. What is the supported workflow for this?

OK. Then this use case may need to change the preprocess code, cause the bufferpool is full now. Could you try to set the process-on-all-objects=1 in the [group-0] field? Or you can wait for our next version: tao_others. We will release a similar demo for this.

Setting process-on-all-objects=1 changed nothing.
I have modified the preprocessing library to remove stale ROIs. It’s a bit hacky but at least seems to work for my application.
I will wait for the next release for the proper implementation. Is there an ETA?

We cannot disclose the internal ETA. It will be soon. Please follow the updates for the following projects: deepstream_tao_apps.

1 Like

DeepStream 6.3 is released: DeepStream 6.3 is now available for download! - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums, please verify on the new version and let us know if there is any issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.