Pipeline error with Python

Please provide complete information as applicable to your setup.

• Jetson AGX Xavier
• DeepStream 6.1
• JetPack Version 5.0.2-b231
• TensorRT Version 8.4.1.5-1
• Pipeline execution

Hi, i’m trying to use the python program allowing me to use Camera USB device for source of my pipeline from here https://github.com/NVIDIA-AI-IOT/deepstream_python_apps .
Unfortunately when i run it i get this error :

Error: gst-stream-error-quark: Internal data stream error. (1): gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:usb-cam-source:
streaming stopped, reason not-negotiated (-4)

I also see this :

WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1950> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine

while i cannot see the file “resnet10.caffemodel_b1_gpu0_int8.engine” in the folder where it supposed to be.

there is the totaly of my terminal when i process the script:

Creating Pipeline
Creating Source
Creating Video Converter
Creating EGLSink
Playing cam /dev/video0
Adding elements to Pipeline
Linking elements in the Pipeline
Starting pipeline
Using winsys: x11
0:00:01.987271355 5432 0x34170a00 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1170> [UID = 1]: Warning, OpenCV has been deprecated. Using NMS for clustering instead of cv::groupRectangles with topK = 20 and NMS Threshold = 0.5
WARNING: Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.1/sources/deepstream_python_apps/apps/deepstream-test1-usbcam/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:06.724915006 5432 0x34170a00 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1897> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.1/sources/deepstream_python_apps/apps/deepstream-test1-usbcam/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:06.783401090 5432 0x34170a00 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2002> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.1/sources/deepstream_python_apps/apps/deepstream-test1-usbcam/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:06.783479014 5432 0x34170a00 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1923> [UID = 1]: Trying to create engine from model files
WARNING: [TRT]: The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible.
WARNING: Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine opened error
0:01:04.929821293 5432 0x34170a00 WARN nvinfer gstnvinfer.cpp:643:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1950> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT input_1 3x368x640
1 OUTPUT kFLOAT conv2d_bbox 16x23x40
2 OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40
0:01:05.003262865 5432 0x34170a00 INFO nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus: [UID 1]: Load new model:dstest1_pgie_config.txt sucessfully
Error: gst-stream-error-quark: Internal data stream error. (1): gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:usb-cam-source:
streaming stopped, reason not-negotiated (-4)

Where does the error come from ?

The pipeline you’re using seems to request for "video/x-raw, framerate=30/1" capabilities from your USB Camera.
Have you confirmed whether your camera is able to produce raw frames at a framerate of 30?

You can use v4l2-ctl --list-formats-ext to check .

oh you are right my camera isn’t in the right format:

Type: Video Capture
[0]: ‘YUYV’ (YUYV 4:2:2)
Size: Discrete 1280x720
Interval: Discrete 0.017s (60.000 fps)

How can i update my python file to make it works ?
deepstream_test_1_usb.py (10.5 KB)

i’ve seen topics in the forum that propose one line instead of an other, eg :https://forums.developer.nvidia.com/t/error-gst-stream-error-quark/183181/7?u=martin.morand

but i cannot find the initial line in the py program and it seems split all over the program…

You should be able to change this line:
caps_v4l2src.set_property('caps', Gst.Caps.from_string("video/x-raw, framerate=30/1"))

Change to:
caps_v4l2src.set_property('caps', Gst.Caps.from_string("video/x-raw, framerate=60/1"))

And also change this:

    streammux.set_property('width', 1920)
    streammux.set_property('height', 1080)

to

    streammux.set_property('width', 1280)
    streammux.set_property('height', 720)
1 Like

thank you so much, i just solved by myself 10 minutes ago !
I will add the streammux property but its worked without it (surely because the camera film in fullHD and the convert it)

Yes, it will work even if you don’t modify streammux’s config. Streammux will resize according to the properties set. But capsfilter will give you data stream error if correct values are not set (in your case the video framerate and format)

1 Like

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