Yolov8 using deepstream jetson nano

i have a custom yolov8 model that i want to run with deepstream This is my config_infer_primary.txt file [property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
onnx-file=/home/nihal/Nihal/Pothole_And_Speed/best.onnx
model-engine-file=model_b1_gpu0_fp32.engine
#int8-calib-file=calib.table
labelfile-path=/home/nihal/Nihal/Pothole_And_Speed/label.txt
batch-size=1
network-mode=0
num-detected-classes=6
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
symmetric-padding=1
#workspace-size=2000
parse-bbox-func-name=NvDsInferParseYolo
#parse-bbox-func-name=NvDsInferParseYoloCuda
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
engine-create-func-name=NvDsInferYoloCudaEngineGet

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25 This is my deepstream_app_config.txt file [application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=1
rows=1
columns=1
width=1280
height=720
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=1
type=3
uri=file:///home/nihal/Nihal/Pothole_And_Speed/output_h264_main.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[sink0]
enable=1
type=2
sync=0
gpu-id=0
nvbuf-memory-type=0

[osd]
enable=1
gpu-id=0
border-width=5
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[streammux]
gpu-id=0
live-source=0
batch-size=1
batched-push-timeout=40000
width=640
height=640
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary_yoloV8.txt

[tests]
file-loop=0 topk=300 Now while i run i get GST_DEBUG=3 deepstream-app -c deepstream_app_config.txt

Using winsys: x11
0:00:15.121313898 6967 0x7f44001f80 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/home/nihal/DeepStream-Yolo/model_b1_gpu0_fp32.engine
INFO: [Implicit Engine Info]: layers num: 2
0 INPUT kFLOAT images 3x640x640
1 OUTPUT kFLOAT output0 10x8400

0:00:15.123465610 6967 0x7f44001f80 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /home/nihal/DeepStream-Yolo/model_b1_gpu0_fp32.engine
0:00:15.212529651 6967 0x7f44001f80 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary_gie> [UID 1]: Load new model:/home/nihal/DeepStream-Yolo/config_infer_primary_yoloV8.txt sucessfully
0:00:15.214691885 6967 0x7f44001f80 WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete: pad not activated yet
0:00:15.215786961 6967 0x7f44001f80 WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete: pad not activated yet

Runtime commands:
h: Print this help
q: Quit

p: Pause
r: Resume

NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
To go back to the tiled display, right-click anywhere on the window.

**PERF: FPS 0 (Avg)
**PERF: 0.00 (0.00)
** INFO: <bus_callback:194>: Pipeline ready

0:00:15.272990841 6967 0x7f000760f0 WARN qtdemux qtdemux_types.c:233:qtdemux_type_get: unknown QuickTime node type pasp
0:00:15.273171522 6967 0x7f000760f0 WARN qtdemux qtdemux.c:3031:qtdemux_parse_trex: failed to find fragment defaults for stream 1
Opening in BLOCKING MODE
0:00:15.934885885 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
0:00:15.935014117 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:15.935107713 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:15.935175891 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:15.935242976 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:15.935309696 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
0:00:16.042884080 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
0:00:16.042999551 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:16.043146741 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:16.043261900 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:16.043360444 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
0:00:16.043465134 6967 0x7ef8028630 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x7ef0021390 Failed to determine interlace mode
** INFO: <bus_callback:180>: Pipeline running

0:00:16.057253658 6967 0x7ef8028630 WARN v4l2videodec gstv4l2videodec.c:1755:gst_v4l2_video_dec_decide_allocation: Duration invalid, not setting latency
0:00:16.058026018 6967 0x7ef8028630 WARN v4l2bufferpool gstv4l2bufferpool.c:1087:gst_v4l2_buffer_pool_start:nvv4l2decoder0:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:16.066977824 6967 0x7ef0008d40 WARN v4l2bufferpool gstv4l2bufferpool.c:1536:gst_v4l2_buffer_pool_dqbuf:nvv4l2decoder0:pool:src Driver should never set v4l2_buffer.field to ANY
**PERF: 0.00 (0.00)
Segmentation fault (core dumped) I also get a black screen but video is working while gst launch

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• 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)
• The pipeline being used

Deepstream = 6.0.1
Jetpack = 4.6
TensorRT = 8.2.1.1
CUDA = 10.2
UBUNTU= 18.04

You can use gdb tool to do a preliminary analysis.

$gdb --args <your_command>
$r
$bt

r
Starting program: /usr/bin/deepstream-app -c deepstream_app_config.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/aarch64-linux-gnu/libthread_db.so.1”.
[New Thread 0x7f7ea8ede0 (LWP 10250)]

Using winsys: x11
[New Thread 0x7f757d4de0 (LWP 10251)]
[New Thread 0x7f74e64de0 (LWP 10252)]
[New Thread 0x7f6fffede0 (LWP 10253)]
[New Thread 0x7f6f7fdde0 (LWP 10254)]
[New Thread 0x7f6effcde0 (LWP 10255)]
[New Thread 0x7f6e7fbde0 (LWP 10256)]
[New Thread 0x7f6dffade0 (LWP 10257)]
0:00:20.653850027 10247 0x7f58001f80 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/home/nihal/DeepStream-Yolo/model_b1_gpu0_fp32.engine
INFO: [Implicit Engine Info]: layers num: 2
0 INPUT kFLOAT images 3x640x640
1 OUTPUT kFLOAT output0 10x8400

0:00:20.662239775 10247 0x7f58001f80 INFO nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /home/nihal/DeepStream-Yolo/model_b1_gpu0_fp32.engine
[New Thread 0x7f51abede0 (LWP 10263)]
[New Thread 0x7f512bdde0 (LWP 10264)]
[New Thread 0x7f50abcde0 (LWP 10265)]
0:00:20.754122040 10247 0x7f58001f80 INFO nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary_gie> [UID 1]: Load new model:/home/nihal/DeepStream-Yolo/config_infer_primary_yoloV8.txt sucessfully
[New Thread 0x7f29b4ede0 (LWP 10266)]
[New Thread 0x7f2934dde0 (LWP 10267)]
[New Thread 0x7f28b4cde0 (LWP 10268)]
[New Thread 0x7f13ffede0 (LWP 10269)]
[New Thread 0x7f137fdde0 (LWP 10270)]

Runtime commands:
h: Print this help
q: Quit

p: Pause
r: Resume

NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
To go back to the tiled display, right-click anywhere on the window.

**PERF: FPS 0 (Avg)
**PERF: 0.00 (0.00)
** INFO: <bus_callback:194>: Pipeline ready

[New Thread 0x7f12ffcde0 (LWP 10271)]
[New Thread 0x7f127fbde0 (LWP 10272)]
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
[New Thread 0x7f11ffade0 (LWP 10274)]
[New Thread 0x7f117f9de0 (LWP 10275)]
[New Thread 0x7f10ff8de0 (LWP 10276)]
NvMMLiteBlockCreate : Block : BlockType = 261
[New Thread 0x7f03ffede0 (LWP 10277)]
[New Thread 0x7f037fdde0 (LWP 10278)]
** INFO: <bus_callback:180>: Pipeline running

[New Thread 0x7f02ffcde0 (LWP 10279)]
[New Thread 0x7f027fbde0 (LWP 10280)]
[New Thread 0x7f01ffade0 (LWP 10281)]
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
[Thread 0x7f037fdde0 (LWP 10278) exited]
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)

Thread 10 “deepstream-app” received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f51abede0 (LWP 10263)]
0x0000007f745fccb8 in decodeTensorYolo(float const*, float const*, float const*, unsigned int const&, unsigned int const&, unsigned int const&, std::vector<float, std::allocator > const&) ()
from /home/nihal/DeepStream-Yolo/nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
IAM GETTING A BLACK SCREEN

It crashed in the decodeTensorYolo. This is the parsing function you set in the config_infer_primary_yoloV8.txt. You need to debug that yourself.

decodeTensorYolo is used for implementing bounding boxes right? But for bounding box to work the video should be displayed right but only black screen appearing , sink i used type=2. Sorry Iam completely new to deepstream i maybe wrong.

The decodeTensorYolo is used to parse the model output by yourself. It crashed in this function through the gdb debugging before. So you need to debug this customized function by yourself first.
If you get this function from someone else’s project, you can try to ask the author directly in that project.

The issue was resolved , the problem was the with onnx model normal conversion didnt work , i used a python program provided by them for exporting to onnx " python3 export_yoloV8.py -w /home/rishad/NIhal/Pothole_and_speed/yolov8s.pt --batch 32 --simplify" , now i tried changing the source type=1 and disabled tiled display , and matched source resolution to sink resolution . This is my deepstream_config.txt : [application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=0

[source0]
enable=1
type=1
uri=/dev/video0
num-sources=1
gpu-id=0
cudadec-memtype=0
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1

[sink0]
enable=1
type=2
sync=0
gpu-id=0
nvbuf-memory-type=0

[osd]
enable=1
gpu-id=0
border-width=5
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[streammux]
gpu-id=0
live-source=1
batch-size=1
batched-push-timeout=40000
width=640
height=480
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary_yoloV8.txt

[tests]
file-loop=0 Now the problem is detection is taking place but the problem is with the video streaming , there is buffering in the video the frames are read and displayed slowly . When frames are displayed detection is taking place . Is this a problem with my model or jetson nano hardware limitation or problem with deepstream_config.txt.

It’s a jetson nano hardware limitation. You can try to set interval=10 in your config_infer_primary_yoloV8.txt. It will reason every ten frames to reduce the loading.

1 Like

Yes i have done that but skipping the frames doesnt make real time object detection good. Is there any other way

Because of the limitations of the perf of your board, there is no other good method for this. You can lower the fps of your source or use a model that takes up less resources.

The issue was resolved,the problem was while converting into onnx python3 export_yoloV8.py -w /home/rishad/NIhal/Pothole_and_speed/yolov8s.pt --batch 32 --simplify this is what i used before for conversion , I changed into python3 export_yoloV8.py -w /home/rishad/NIhal/Pothole_and_speed/yolov8s.pt --batch 1 --simplify this reducing the batch resolved the issue and simplifying solved the segmentation fault.

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