# Deepstream-YOLO-seg custom yolov8 onnx model not working as expected

**URL:** <https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365>\
**Category:** DeepStream SDK\
**Tags:** onnx, segmentation\
**Created:** [October 23, 2023, 12:22pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365 "2023-10-23T12:22:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 23, 2023, 12:22pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/1 "2023-10-23T12:22:26Z")

</div>

**Hardware Platform (Jetson / GPU) = Jetson nano**  
**DeepStream Version = 6.0.1**  
**JetPack Version (valid for Jetson only) = 4.6.1**  
**TensorRT Version = 8.2.1.8-1+cuda10.2**  
**Python version = 3.6.9**

I have followed this link and perform all the steps

> [https://github.com/marcoslucianops/DeepStream-Yolo-Seg/blob/master/docs/YOLOv8\_Seg.md](https://github.com/marcoslucianops/DeepStream-Yolo-Seg/blob/master/docs/YOLOv8_Seg.md)

I have converted my custom yolov8-seg model into onnx using

> python3 export\_yoloV8.py -w yolov8s.pt --dynamic --simplify

While running this command

> deepstream-app -c deepstream\_app\_config.txt

i am getting this output

> Using winsys: x11  
> 0:00:53.989521935 14418 0x7fb3400 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 :/opt/nvidia/deepstream/DeepStream-Yolo-Seg/kerbhit\_yolov8\_seg.onnx\_b1\_gpu0\_fp32.engine  
> INFO: [Implicit Engine Info]: layers num: 3  
> 0 INPUT kFLOAT images 3x640x640  
> 1 OUTPUT kFLOAT output1 32x160x160  
> 2 OUTPUT kFLOAT output0 39x8400  
> 0:00:54.003349141 14418 0x7fb3400 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: /opt/nvidia/deepstream/DeepStream-Yolo-Seg/kerbhit\_yolov8\_seg.onnx\_b1\_gpu0\_fp32.engine  
> 0:00:54.288551776 14418 0x7fb3400 INFO nvinfer gstnvinfer\_impl.cpp:313:notifyLoadModelStatus:\<primary\_gie\> [UID 1]: Load new model:/opt/nvidia/deepstream/DeepStream-Yolo-Seg/config\_infer\_primary\_yoloV8\_seg.txt sucessfully  
> 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  
> Opening in BLOCKING MODE  
> NvMMLiteOpen : Block : BlockType = 260  
> NVMEDIA: Reading vendor.tegra.display-size : status: 6  
> NvMMLiteBlockCreate : Block : BlockType = 260  
> \*\* INFO: \<bus\_callback:180\>: Pipeline running  
> \*\*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)   
> \*\*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)   
> \*\*PERF: 0.00 (0.00)

> And a new window with blank screen

Please help me with it.  
Thank you

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 23, 2023, 2:20pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/3 "2023-10-23T14:20:22Z")

</div>

could you share more logs? please do “export GST\_DEBUG=6” first to modify Gstreamer’s log level, then run again, you can redirect the logs to a file.  
**deepstream-app -c deepstream\_app\_config.txt \>1.log 2\>1.log**  
you can compress the 1.log by zip.

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 25, 2023, 6:38am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/5 "2023-10-25T06:38:29Z")

</div>

Please find attached the log file and gst debug file  
[1.log](https://forums.developer.nvidia.com/uploads/short-url/mBzXmacfwlfCTT7b7ILlxdpZIKC.log) (2.1 KB)

[gst.log](https://forums.developer.nvidia.com/uploads/short-url/72azgmyrqZ9dqtlJdJ6oPGzCRX0.log) (14.5 MB)

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 25, 2023, 2:50pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/6 "2023-10-25T14:50:17Z")

</div>

1. did you modify the code? if not modify the code and configuration, can the app run fine?
2. the gst.log is too short, there is no nvinfer’s log after “Load new model”. could you share more logs? Thanks!

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 26, 2023, 6:15am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/7 "2023-10-26T06:15:08Z")

</div>

I have not modified the code and any configuration. The standard deepstream-apps and their samples are running fine. I am trying Deepstream-YOLO-seg for the first time.

for gst.log i have done two steps

1. export GST\_DEBUG=6
2. export GST\_DEBUG\_FILE=/tmp/gst.log

and store all the gst debugger logs in a file and that i have shared with you its size is around 14 mb.

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 26, 2023, 6:59am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/8 "2023-10-26T06:59:43Z")

</div>

May i use the below link

> [https://github.com/NVIDIA-AI-IOT/deepstream\_python\_apps/tree/master/apps/deepstream-segmentation](https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/tree/master/apps/deepstream-segmentation)

for image segmentation but they require .engine and .uff files but i only have pytorch and onnx file.  
Is there any document available to use custome image segmentation model using deepstream python bindings

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 26, 2023, 2:49pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/9 "2023-10-26T14:49:51Z")

</div>

1. could you share the model? Thanks! when I execute “python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --dynamic”, there is an error “ModuleNotFoundError: No module named ‘ultralytics.yolo’”.
2. Deepstream nvinfer can support onnx mdoel. please refer to [sample](https://github.com/marcoslucianops/DeepStream-Yolo-Seg/blob/master/config_infer_primary_yoloV7_seg.txt#L5).

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 26, 2023, 5:09pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/10 "2023-10-26T17:09:35Z")

</div>

In export\_yolov8\_seg.py change the line number 11 from

> from ultralytics.yolo.utils.torch\_utils import select\_device

to this

> from ultralytics.utils.torch\_utils import select\_device

The error “ModuleNotFoundError: No module named ‘ultralytics.yolo’” will be removed .

for your second point link we are trying the same only but its not working. So I want some python bindings or in existing python-deepstream-app folder where i can use onnx or pytorch file or some way to convert it into uff file.

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 27, 2023, 2:06am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/11 "2023-10-27T02:06:21Z")

</div>

> [@Keshav.A](#):
>
> > python3 export\_yoloV8.py -w yolov8s.pt --dynamic --simplify

did you mistake the model? Deepstream-YOLO-seg is for segmentation model. yolov8s.pt is detector model.

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 27, 2023, 5:36am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/12 "2023-10-27T05:36:40Z")

</div>

No I have used export\_yoloV8\_seg.py file. Sorry that was my type mistake

I have used

> python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --dynamic --simplify

but this yolov8s-seg.pt is my new custom model trained on 3 classes

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 28, 2023, 1:38pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/13 "2023-10-28T13:38:40Z")

</div>

1. from the logs, there is no decoding output from timestamp “0:01:21.9”.  
could you share source file Cam1\_12072301.avi? we need to check if there is decoding issue.
2. can the app run well if using deepstream sample video?  
I did not modify the configuration and model. this app run fine. here is the output log.[testlog.txt](https://forums.developer.nvidia.com/uploads/short-url/zxFKPB30MbTDX0XfU7Sy5NBpyRv.txt) (2.5 KB)

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 30, 2023, 8:37am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/14 "2023-10-30T08:37:46Z")

</div>

sorry i can’t share the video or model file.  
But I have done few things. Please find below details.

1. I have created two onnx model from pytorch model using below commands.

> python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --dynamic --simplify

> python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --simplify

1. I have created the setup again using the link that i have provided earlier. And run the following command.

> deepstream-app -c deepstream\_app\_config.txt \> log1

I am getting new error please find it below.  
[TerminalOUTPUT.txt](https://forums.developer.nvidia.com/uploads/short-url/nhR670y3PquMFVykk0Kwa3yAm5I.txt) (4.4 KB)  
[log1.txt](https://forums.developer.nvidia.com/uploads/short-url/2KRHh4zc3mL0uLWgcaqgioxTblG.txt) (478 Bytes)

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 30, 2023, 9:10am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/15 "2023-10-30T09:10:41Z")

</div>

please refer to my last comment. the app ran well. please use my [model](https://drive.google.com/file/d/1evQGQtcp29WQbPpW9nTitPRlrPQt2VZJ/view?usp=sharing) to have a try. the generated command is python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --dynamic --simplify.

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 30, 2023, 12:06pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/16 "2023-10-30T12:06:25Z")

</div>

same error with your model as well

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [October 30, 2023, 2:00pm UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/17 "2023-10-30T14:00:53Z")

</div>

> [@Keshav.A](#):
>
> Use deserialized engine model: /opt/nvidia/deepstream/DeepStream-Yolo-Seg/kerbhit\_yolov8\_seg.onnx\_b1\_gpu0\_fp32.engine

int the description, the engine was generated successfully. but in TerminalOUTPUT.txt, the app failed to generate engine. are there any different steps?

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [October 31, 2023, 6:10am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/18 "2023-10-31T06:10:52Z")

</div>

please refer to this answer

> [@Deepstream-YOLO-seg custom yolov8 onnx model not working as expected](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/14):
>
> sorry i can’t share the video or model file. But I have done few things. Please find below details. I have created two onnx model from pytorch model using below commands. python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --dynamic --simplify python3 export\_yoloV8\_seg.py -w yolov8s-seg.pt --simplify I have created the setup again using the link that i have provided earlier. And run the following command. deepstream-app -c deepstream\_app\_config.txt \> log1 I am getting new error please …

I have again done the setup with same steps but now getting different error. The Error where engine file itself is not generating. And also tried with your given model then too engine file is not generating i checked my steps twice but don’t know why this is happening, may be some versioning problem but don’t know exactly

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [November 7, 2023, 6:28am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/19 "2023-11-07T06:28:17Z")

</div>

I have flash the jet-pack again reinstall everything and all standard samples of deepstream apps are running but when i try to use below link

> [GitHub - marcoslucianops/DeepStream-Yolo-Seg: NVIDIA DeepStream SDK 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 implementation for YOLO-Segmentation models](https://github.com/marcoslucianops/DeepStream-Yolo-Seg#basic-usage)

and trying to test it with the seg model that you have provided i am getting same error.

Please help me out

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [November 7, 2023, 6:39am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/20 "2023-11-07T06:39:59Z")

</div>

> [@Keshav.A](#):
>
> I have flash the jet-pack again reinstall everything

sorry for the late replay. is the current system JetPack4.6.1+DS6.0? could you share the output of this command-line?  
**/usr/src/tensorrt/bin/trtexec --fp16 --onnx=yolov8s-seg.onnx --saveEngine=1.engine --minShapes=input:1x3x640x640 --optShapes=input:1x3x640x640 --maxShapes=input:1x3x640x640 --shapes=input:1x3x640x640 --workspace=10000**

---

<div class="post-metadata">

**Author:** ![Keshav.A](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Keshav.A](https://forums.developer.nvidia.com/u/Keshav.A)\
**Post date:** [November 7, 2023, 6:56am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/22 "2023-11-07T06:56:30Z")

</div>

yes it is  
**Hardware Platform (Jetson / GPU) = Jetson nano**  
**DeepStream Version = 6.0.1**  
**JetPack Version (valid for Jetson only) = 4.6.1**  
**TensorRT Version = 8.2.1.8-1+cuda10.2**  
**Python version = 3.6.9**

[terminalOutput.txt](https://forums.developer.nvidia.com/uploads/short-url/zrXPMLw8dl3MnyOO906oOZ8AxdX.txt) (7.1 KB)

---

<div class="post-metadata">

**Author:** ![fanzh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fanzh/32/115955_2.png) [@fanzh](https://forums.developer.nvidia.com/u/fanzh)\
**Post date:** [November 7, 2023, 7:20am UTC](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365/23 "2023-11-07T07:20:42Z")

</div>

from log, there is an error “ERROR: [TRT]: ModelImporter.cpp:773: While parsing node number 290 [RoiAlign → “/1/RoiAlign\_output\_0”]:”. it is because the TensorRT version does not support RoiAlign Ops.  
please refer to this [topic](https://forums.developer.nvidia.com/t/assertion-failed-creator-plugin-not-found-are-the-plugin-name-version-and-namespace-correct/212387).

[Next page](https://forums.developer.nvidia.com/t/deepstream-yolo-seg-custom-yolov8-onnx-model-not-working-as-expected/270365.md?page=2)
