# Custom new model segmentation in DeepStream

**URL:** <https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800>\
**Category:** DeepStream SDK\
**Tags:** tensorflow\
**Created:** [January 17, 2023, 4:46am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800 "2023-01-17T04:46:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 17, 2023, 4:46am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/1 "2023-01-17T04:46:53Z")

</div>

Dear Sir/Madam,

I want to implement a custom model segmentation, what do I need to do?  
Detail:

- I use model segmentation PWCNet in github([GitHub - antonilo/unsupervised\_detection: An Unsupervised Learning Framework for Moving Object Detection From Videos](https://github.com/antonilo/unsupervised_detection)).
- I don’t know how to implement the model in DeepStream.  
Can you help me? Thanks so much.

**• 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)**

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 17, 2023, 8:28am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/3 "2023-01-17T08:28:30Z")

</div>

DeepStream can support the following types of models:

- Caffe Model and Caffe Prototxt
- ONNX
- UFF file
- TAO Encoded Model and Key

Please make sure you can generate the above types of models first. And then you can study DeepStream document for how to use DeepStream to deploy the models. [Welcome to the DeepStream Documentation — DeepStream 6.1.1 Release documentation](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Overview.html)

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 17, 2023, 9:10am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/4 "2023-01-17T09:10:29Z")

</div>

> [@Fiona.Chen](#):
>
> ypes of models

So is a tensorflow custom model supported?

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 17, 2023, 10:35am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/5 "2023-01-17T10:35:29Z")

</div>

You’d better transfer it to ONNX. [Getting Started - TensorFlow | onnxruntime](https://onnxruntime.ai/docs/tutorials/tf-get-started.html)

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 2:12am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/6 "2023-01-30T02:12:46Z")

</div>

How can I run deep stream segmentation with ONNX model?

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 3:18am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/7 "2023-01-30T03:18:11Z")

</div>

Please refer to the [NVIDIA-AI-IOT/deepstream\_tao\_apps: Sample apps to demonstrate how to deploy models trained with TAO on DeepStream (github.com)](https://github.com/NVIDIA-AI-IOT/deepstream_tao_apps). There are segmentation model sample and ONNX model sample.

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 8:48am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/8 "2023-01-30T08:48:20Z")

</div>

- I trained unet model. My weight file format is .tlt, But in example unet in “Deepstream\_tao\_apps”, I saw tlt-encoded-model format is .etlt.
- I try export .tlt model to .etlt model with code below:  
!tao unet export   
-e $SPECS\_DIR/unet\_train\_resnet\_unet\_isbi.txt   
-m $EXPERIMENT\_DIR/isbi\_experiment\_unpruned/weights/model\_isbi.tlt   
-o $EXPERIMENT\_DIR/isbi\_experiment\_unpruned/model\_isbi.etlt   
-k $KEY
- But when I run “./apps/tao\_segmentation/ds-tao-segmentation configs/app/seg\_app\_unet.yml”. I got an error  
 ![image](https://global.discourse-cdn.com/nvidia/original/3X/3/b/3bfaccd49bd8c9cc10b48f25c7a2bf0a0eaefd51.png)

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 9:13am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/9 "2023-01-30T09:13:53Z")

</div>

Please provide complete information as applicable to your setup.

**• 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)**

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 9:27am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/10 "2023-01-30T09:27:28Z")

</div>

Steps:

1. I try to train model Unet with TAO toolkit follow(Run in colab): [https://github.com/NVIDIA-AI-IOT/nvidia-tao/blob/main/tensorflow/unet/unet\_isbi.ipynb](https://github.com/NVIDIA-AI-IOT/nvidia-tao/blob/main/tensorflow/unet/unet_isbi.ipynb)
2. After train, I export model weight .tlt to .etlt follow:  
!tao unet export   
-e $SPECS\_DIR/unet\_train\_resnet\_unet\_isbi.txt   
-m $EXPERIMENT\_DIR/isbi\_experiment\_unpruned/weights/model\_isbi.tlt   
-o $EXPERIMENT\_DIR/isbi\_experiment\_unpruned/model\_isbi.etlt   
–engine\_file $EXPERIMENT\_DIR/isbi\_experiment\_unpruned/model\_isbi.engine   
–gen\_ds\_config   
-k $KEY
3. I setup file pgie\_unet\_tao\_config.yml:  
property:  
gpu-id: 0  
net-scale-factor: 0.007843  
model-color-format: 1  
offsets: 127.5;127.5;127.5  
labelfile-path: unet\_labels.txt  
##Replace following path to your model file  
model-engine-file: ../../models/unet/model\_isbi.engine  
#current DS cannot parse onnx etlt model, so you need to  
#convert the etlt model to TensoRT engine first use tao-convert  
tlt-encoded-model: ../../models/unet/model\_isbi.etlt  
tlt-model-key: tlt\_encode  
infer-dims: 3;320;320  
batch-size: 1

## 0=FP32, 1=INT8, 2=FP16 mode

network-mode: 1  
num-detected-classes: 2  
interval: 0  
gie-unique-id: 1  
network-type: 2  
output-blob-names: softmax\_1  
segmentation-threshold: 0.0  
##specify the output tensor order, 0(default value) for CHW and 1 for HWC  
segmentation-output-order: 1

class-attrs-all:  
roi-top-offset: 0  
roi-bottom-offset: 0  
detected-min-w: 0  
detected-min-h: 0  
detected-max-w: 0  
detected-max-h: 0

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 9:32am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/11 "2023-01-30T09:32:17Z")

</div>

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU)**  
**• DeepStream Version**  
**• JetPack Version (valid for Jetson only)**  
**• TensorRT Version**  
**• NVIDIA GPU Driver Version (valid for GPU only)**

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 9:47am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/12 "2023-01-30T09:47:28Z")

</div>

**• Hardware Platform: GPU**  
**• DeepStream Version: 6.1**  
**• TensorRT Version: 7.2.1.4**  
\*\*• NVIDIA GPU Driver Version (valid for GPU only): Driver Version: 510.108.03 CUDA Version: 11.6 \*\*

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 9:53am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/13 "2023-01-30T09:53:26Z")

</div>

DeepStream 6.1 needs TensorRT 7.2.5.1. [Quickstart Guide — DeepStream 6.1.1 Release documentation](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html#id6)

Please check your device and confirm the real versions.

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 10:01am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/14 "2023-01-30T10:01:04Z")

</div>

> [@Fiona.Chen](#):
>
> Please check your device and confirm the real versions.

I can’t find TensorRT in my device. TensorRT Version: 7.2.1.4 is in Colab when I train Unet model.

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 10:05am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/15 "2023-01-30T10:05:12Z")

</div>

DeepStream can not work without TensorRT. Are you working with DeepStream docker container? Please check the device or environment which you want to run DeepStream on.

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 10:10am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/16 "2023-01-30T10:10:33Z")

</div>

I don’t run DeepStream with Docker, Maybe I run DeepStream with TensorRT but I don’t know how to check TensorRT version

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 10:13am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/17 "2023-01-30T10:13:11Z")

</div>

Please try `dpkg -l | grep TensorRT`

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 10:14am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/18 "2023-01-30T10:14:35Z")

</div>

Here you are:

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/5/0/5039f61d4b9dd3a9c55fa92d6ba8131433075298.png)

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 10:16am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/19 "2023-01-30T10:16:23Z")

</div>

TensorRT version is not correct. Please refer to the DeepStream compatibility table.

[https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS\_Quickstart.html#id6](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html#id6)

---

<div class="post-metadata">

**Author:** ![pesuyn444](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pesuyn444](https://forums.developer.nvidia.com/u/pesuyn444)\
**Post date:** [January 30, 2023, 10:19am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/20 "2023-01-30T10:19:52Z")

</div>

I will try change version TensorRT. But why am i still able to run the example of Unet model?

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [January 30, 2023, 10:21am UTC](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800/21 "2023-01-30T10:21:17Z")

</div>

You’ve already met the TensorRT failure from the log you post. “TRT” is the abbreviation of “TensorRT”

[Next page](https://forums.developer.nvidia.com/t/custom-new-model-segmentation-in-deepstream/239800.md?page=2)
