Skip to content

Instantly share code, notes, and snippets.

@pra-dan
Created December 20, 2021 14:06
Show Gist options
  • Save pra-dan/7fe6c6341d83bceb7b9dcca5a7a08350 to your computer and use it in GitHub Desktop.
Save pra-dan/7fe6c6341d83bceb7b9dcca5a7a08350 to your computer and use it in GitHub Desktop.
# Install DeepStream 5.1
- Flash JetPack 4.5.1 which comes installed with DeepStream 5.1.
# Install Prerequisites
## Install packages. Run `requirements.sh`
## Follow instructions given in `/opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream_app/README` as follows:
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libgstrtspserver-1.0-dev libx11-dev
# Obtain inference engine using `trtexec`
## Upload your model to project directory (e.g., `/home/virus/Desktop/optimisation`)
## `trtexec` is already provided in JetPack and can be found in `/usr/src/tensorrt/samples`. Compile it using
cd /usr/src/tensorrt/samples/trtexec/
sudo make
## The builds can be found in `/usr/src/tensorrt/bin`. Run `trtexec` to export engine
cd /usr/src/tensorrt/bin
sudo ./trtexec --uff=/home/virus/Desktop/optimisation/res101-holygrail-ep26.uff --uffInput=input_image,3,1024,1024 --output="mrcnn_mask/Sigmoid" --fp16 --saveEngine=res101-holygrail-ep26-fp16.engine
## More info on reading other model types like Uff, ONNX, etc, refer to the [official README](https://github.com/NVIDIA/TensorRT/tree/master/samples/trtexec#tool-command-line-arguments).
## Copy the generated engine file to the project directory.
cp res101-holygrail-ep26-fp16.engine ~/Desktop/optimisation/
# Clone python samples
cd ~/Desktop/optimisation/
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
cd deepstream_python_apps/
# Edit config file. Use either `dstest_segmentation_config_industrial.txt` or `dstest_segmentation_config_semantic.txt`
## My changes included
[property]
gpu-id=0
net-scale-factor=0.003921568627451
model-color-format=0
uff-file=/home/virus/Desktop/optimisation/res101-holygrail-ep26.uff
model-engine-file=/home/virus/Desktop/optimisation/res101-holygrail-ep26-fp16.engine
infer-dims=3;1024;1024
uff-input-order=0
uff-input-blob-name=input_image
batch-size=1
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=2
num-detected-classes=4
interval=0
gie-unique-id=1
network-type=2
output-blob-names=mrcnn_mask/Sigmoid
segmentation-threshold=0.5
labelfile-path=custom_labels.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment