Deepstream-nvof-test Error: ofsdk error at line 160, code 2

Hi,
I am running Deepstream 5.1 on Dell G5 15 the GPU is GTX 1650ti the OS is Ubuntu 18.04.5LTS tensorrt version 7.2.3.4 GPU Driver 460.56 CUDA version 11.2

I get this error when running deepstream-nvof-app file:///opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_720p.h264.

Now playing: file:///opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_720p.h264,
Device Number: 0
Device name: GeForce GTX 1650 Ti
Device Version 7.5
  Device Supports Optical Flow Functionality

Decodebin child added: source
Decodebin child added: decodebin0
Running...
Decodebin child added: h264parse0
Decodebin child added: capsfilter0
Decodebin child added: nvv4l2decoder0
In cb_newpad
gst_ds_optical_flow_set_caps: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ERROR from element h264parse0: Internal data stream error.
Error details: gstbaseparse.c(3611): gst_base_parse_loop (): /GstPipeline:nvof-test-pipeline/GstBin:source-bin-00/GstURIDecodeBin:uri-decode-bin/GstDecodeBin:decodebin0/GstH264Parse:h264parse0:
streaming stopped, reason error (-5)
Returned, stopping playback
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
Deleting pipeline

I compiled the deepstream-nvof-test with this command CUDA_VER=11.2 make

Hey, could you try to run deepstream-test1-app and see if it can work well?

I tested it now and it is working and when I put nvof in any pipeline it crashes and gives me that error.

like this command for testing the dsdirection.

gst-launch-1.0 filesrc location = /opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 nvstreammux name=m batch-size=2 width=1920 height=1080 ! nvinfer config-file-path= /opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app/config_infer_primary.txt ! nvof ! tee name=t ! queue ! nvofvisual ! nvmultistreamtiler width=1920 height=540 ! nveglglessink t. ! queue ! dsdirection ! nvmultistreamtiler width=1920 height=540 ! nvvideoconvert ! nvdsosd ! nveglglessink filesrc location = /opt//nvidia/deepstream/deepstream-5.1/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_1

I get this error.

Setting pipeline to PAUSED ...
Device Number: 0
Device name: GeForce GTX 1650 Ti
Device Version 7.5
  Device Supports Optical Flow Functionality

ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1523 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app/../../models/Primary_Detector/resnet10.caffemodel_b30_gpu0_int8.engine open error
0:00:00.767622461  3681 0x55a3b70a4f50 WARN                 nvinfer gstnvinfer.cpp:616:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1691> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app/../../models/Primary_Detector/resnet10.caffemodel_b30_gpu0_int8.engine failed
0:00:00.767647873  3681 0x55a3b70a4f50 WARN                 nvinfer gstnvinfer.cpp:616:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1798> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app/../../models/Primary_Detector/resnet10.caffemodel_b30_gpu0_int8.engine failed, try rebuild
0:00:00.767657079  3681 0x55a3b70a4f50 INFO                 nvinfer gstnvinfer.cpp:619:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1716> [UID = 1]: Trying to create engine from model files
INFO: ../nvdsinfer/nvdsinfer_func_utils.cpp:39 [TRT]: Reading Calibration Cache for calibrator: EntropyCalibration2
INFO: ../nvdsinfer/nvdsinfer_func_utils.cpp:39 [TRT]: Generated calibration scales using calibration cache. Make sure that calibration cache has latest scales.
INFO: ../nvdsinfer/nvdsinfer_func_utils.cpp:39 [TRT]: To regenerate calibration cache, please delete the existing one. TensorRT will generate a new calibration cache.
INFO: ../nvdsinfer/nvdsinfer_func_utils.cpp:39 [TRT]: Some tactics do not have sufficient workspace memory to run. Increasing workspace size may increase performance, please check verbose output.
INFO: ../nvdsinfer/nvdsinfer_func_utils.cpp:39 [TRT]: Detected 1 inputs and 2 output network tensors.
ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1495 Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-5.1/samples/models/Primary_Detector/resnet10.caffemodel_b30_gpu0_int8.engine opened error
0:01:15.833183832  3681 0x55a3b70a4f50 WARN                 nvinfer gstnvinfer.cpp:616:gst_nvinfer_logger:<nvinfer0> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1744> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-5.1/samples/models/Primary_Detector/resnet10.caffemodel_b30_gpu0_int8.engine
INFO: ../nvdsinfer/nvdsinfer_model_builder.cpp:685 [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:15.837502229  3681 0x55a3b70a4f50 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<nvinfer0> [UID 1]: Load new model:/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app/config_infer_primary.txt sucessfully
Pipeline is PREROLLING ...
Got context from element 'eglglessink1': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
gst_ds_optical_flow_set_caps: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
0:01:16.168330745  3681 0x55a3b6328990 WARN                 nvinfer gstnvinfer.cpp:1984:gst_nvinfer_output_loop:<nvinfer0> error: Internal data stream error.
0:01:16.168341370  3681 0x55a3b6328990 WARN                 nvinfer gstnvinfer.cpp:1984:gst_nvinfer_output_loop:<nvinfer0> error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstNvInfer:nvinfer0: Internal data stream error.
Additional debug info:
gstnvinfer.cpp(1984): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:nvinfer0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 1
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
Freeing pipeline ...

Got, thanks for the info.

Would you mind to share me a simple pipeline where the issue can repro?

Sorry, for my late response. This is a simple pipeline.

gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_720p.h264 ! decodebin ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! nvof ! queue ! nvofvisual ! queue ! nveglglessink

and this is it’s error message. Please let me know if you need the gst-debug output.

Setting pipeline to PAUSED ...
Device Number: 0
Device name: GeForce GTX 1650 Ti
Device Version 7.5
  Device Supports Optical Flow Functionality

Pipeline is PREROLLING ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
gst_ds_optical_flow_set_caps: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse0: Internal data stream error.
Additional debug info:
gstbaseparse.c(3611): gst_base_parse_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
ofsdk error at line 160, code 2
gst_ds_optical_flow_transform_ip: Creating OpticalFlow Context for Source = 0
libnvds_opticalflow_dgpu: Setting GPU_ID = 0
ofsdk error at line 160, code 2
Freeing pipeline ...

Thanks, will try to repro locally

I can repro it locally, will check internally and update you ASAP.

Seems your device cannot support OF, can you refer Optical Flow SDK with Non-Turing GPU