Video capture fails with posenet

Hi

When I use posenet.py with “Pose Optimization with PoseNet” of “Hello AI World” in Jetpack 4.6, the capture fails on the way.
The system setup was done in Docker using GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson..

posenet.py --input-codec = h264 --network = resnet18-body rtsp: //192.1.10.152:12345

When executed, it will be as follows

detected 0 objects in image

[TRT] ----------------------------------------------- ――――
[TRT] Timing Report /usr/local/bin/networks/Pose-ResNet18-Body/pose_resnet18_body.onnx
[TRT] ----------------------------------------------- ――――
[TRT] Pre-Process CPU 0.04230ms CUDA 0.04710ms
[TRT] Network CPU 10.69461ms CUDA 9.91232ms
[TRT] Post-Process CPU 0.36531ms CUDA 0.36451ms
[TRT] Visualize CPU 0.00595ms CUDA 0.00669ms
[TRT] Total CPU 11.10818ms CUDA 10.33062ms
[TRT] ----------------------------------------------- ――――

Traceback (most recent call last):
  File "/usr/local/bin/posenet.py", line 58, in <module>
    img = input.Capture ()
Exception: jetson.utils --videoSource failed to capture image
[gstreamer] gstDecoder --stopping pipeline, transitioning to GST_STATE_NULL
[gstreamer] gstDecoder --onPreroll ()
[gstreamer] gstreamer changed state from PLAYING to PAUSED ==> capsfilter1
[gstreamer] gstreamer changed state from PLAYING to PAUSED ==> omxh264dec-omxh264dec0
[gstreamer] gstreamer changed state from PLAYING to PAUSED ==> h264parse1
[gstreamer] gstreamer changed state from PLAYING to PAUSED ==> rtph264depay1
[gstreamer] gstreamer changed state from PLAYING to PAUSED ==> queue0
[gstreamer] gstDecoder --pipeline stopped

This is not the case with posenet instead of posenet.py.
why?

Hi,
Please run the command and check if you can see video preview:

gst-launch-1.0 uridecodebin uri=‘rtsp://192.1.10.152:12345’ ! nvoverlaysink

Would like to confirm the URI is valid.

Thanks for your comment

gst-launch-1.0 uridecodebin uri ='rtsp: //192.1.10.152:12345'! nvoverlaysink

I tried the above and it was successful.
The URI was valid.
Also, the capture is successful with posenet.cpp instead of posenet.py.

posenet --input-codec = h264 --network = resnet18-body rtsp: //192.1.10.152:12345

Is there any difference between “posenet.py” and “posenet.cpp”?

Thank you

Hi @nakayonum, the minor difference between the C++ and Python version is that the C++ uses a capture timeout of 1000ms and just keeps looping if a frame wasn’t captured. What you could try doing is catching the exception posenet.py after the call to videoSource.Capture() and try again.

Hello dusty_nv
Thank you for your comment
I understand the contents.

Thank you

Hi

When I build a system setup from the source and execute the posenet.py program for each 4ch of input video (1920x1280), the memory allocation fails and some posenet.py programs do not start.
However, all posenet.py programs will start on Docker.
Why?

Hmm, I’m not entirely sure, except that Docker may be limiting the amount of memory that each process is allocating, or perhaps it’s able to share the dynamic libraries instead of reloading them for each process.

By running posenet.py four times independently, you are loading four copies of the posenet model and all the DNN libraries that it uses. To save memory, you could try writing a single posenet program that processed 4 streams while just loading the posenet model once.

Hi dusty_nv
Thank you for your comment.
The possibility of Docker may be true.

Thank you very much.