Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update to latest tensorrt (8.6.1) release * Build trt libyolo_layer.so in container * Update tensorrt_models script to convert models from the frigate container * Fix typo in model script * Fix paths to yolo lib and models folder * Add S6 scripts to test and convert specified TensortRT models at startup. Rearrange tensorrt files into a docker support folder. * Update TensorRT documentation to reflect the new model conversion process and minimum HW support. * Fix model_cache path to live in config directory * Move tensorrt s6 files to the correct directory * Fix issues in model generation script * Disable global timeout for s6 services * Add version folder to tensorrt model_cache path * Include TensorRT version 8.5.3 * Add numpy requirement prior to removal of np.bool * This TRT version uses a mixture of cuda dependencies * Redirect stdout from noisy model conversion
- Loading branch information
Showing
14 changed files
with
125 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ootfs/etc/ld.so.conf.d/cuda_tensorrt.conf → ...ootfs/etc/ld.so.conf.d/cuda_tensorrt.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
53 changes: 53 additions & 0 deletions
53
docker/support/tensorrt_detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/command/with-contenv bash | ||
# shellcheck shell=bash | ||
# Generate models for the TensorRT detector | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
MODEL_CACHE_DIR=${MODEL_CACHE_DIR:-"/config/model_cache/tensorrt"} | ||
OUTPUT_FOLDER="${MODEL_CACHE_DIR}/${TRT_VER}" | ||
|
||
# Create output folder | ||
mkdir -p ${OUTPUT_FOLDER} | ||
|
||
FIRST_MODEL=true | ||
MODEL_CONVERT="" | ||
|
||
for model in ${YOLO_MODELS//,/ } | ||
do | ||
# Remove old link in case path/version changed | ||
rm -f ${MODEL_CACHE_DIR}/${model}.trt | ||
|
||
if [[ ! -f ${OUTPUT_FOLDER}/${model}.trt ]]; then | ||
if [[ ${FIRST_MODEL} = true ]]; then | ||
MODEL_CONVERT="${model}" | ||
FIRST_MODEL=false; | ||
else | ||
MODEL_CONVERT+=",${model}"; | ||
fi | ||
else | ||
ln -s ${OUTPUT_FOLDER}/${model}.trt ${MODEL_CACHE_DIR}/${model}.trt | ||
fi | ||
done | ||
|
||
if [[ -z ${MODEL_CONVERT} ]]; then | ||
echo "No models to convert." | ||
exit 0 | ||
fi | ||
|
||
echo "Generating the following TRT Models: ${MODEL_CONVERT}" | ||
|
||
# Build trt engine | ||
cd /usr/local/src/tensorrt_demos/yolo | ||
|
||
# Download yolo weights | ||
./download_yolo.sh $MODEL_CONVERT > /dev/null | ||
|
||
for model in ${MODEL_CONVERT//,/ } | ||
do | ||
echo "Converting ${model} model" | ||
python3 yolo_to_onnx.py -m ${model} > /dev/null | ||
python3 onnx_to_tensorrt.py -m ${model} > /dev/null | ||
cp ${model}.trt ${OUTPUT_FOLDER}/${model}.trt | ||
ln -s ${OUTPUT_FOLDER}/${model}.trt ${MODEL_CACHE_DIR}/${model}.trt | ||
done |
1 change: 1 addition & 0 deletions
1
docker/support/tensorrt_detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
1 change: 1 addition & 0 deletions
1
docker/support/tensorrt_detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/trt-model-prepare/run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
SCRIPT_DIR="/usr/local/src/tensorrt_demos" | ||
|
||
# Clone tensorrt_demos repo | ||
git clone --depth 1 https://github.com/NateMeyer/tensorrt_demos.git -b conditional_download | ||
|
||
# Build libyolo | ||
cd ./tensorrt_demos/plugins && make all | ||
cp libyolo_layer.so /usr/local/lib/libyolo_layer.so | ||
|
||
# Store yolo scripts for later conversion | ||
cd ../ | ||
mkdir -p ${SCRIPT_DIR}/plugins | ||
cp plugins/libyolo_layer.so ${SCRIPT_DIR}/plugins/libyolo_layer.so | ||
cp -a yolo ${SCRIPT_DIR}/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# NVidia TensorRT Support (amd64 only) | ||
nvidia-pyindex; platform_machine == 'x86_64' | ||
nvidia-tensorrt == 8.4.1.5; platform_machine == 'x86_64' | ||
cuda-python == 11.7; platform_machine == 'x86_64' | ||
--extra-index-url 'https://pypi.nvidia.com' | ||
numpy < 1.24; platform_machine == 'x86_64' | ||
tensorrt == 8.5.3.*; platform_machine == 'x86_64' | ||
cuda-python == 11.8; platform_machine == 'x86_64' | ||
cython == 0.29.*; platform_machine == 'x86_64' | ||
nvidia-cuda-runtime-cu11 == 11.7.*; platform_machine == 'x86_64' | ||
nvidia-cublas-cu11 == 11.11.*; platform_machine == 'x86_64' | ||
nvidia-cudnn-cu11 == 8.7.*; platform_machine == 'x86_64' | ||
nvidia-cuda-nvrtc-cu11 == 11.7.*; platform_machine == 'x86_64' | ||
nvidia-cuda-runtime-cu12 == 12.1.*; platform_machine == 'x86_64' | ||
nvidia-cuda-runtime-cu11 == 11.8.*; platform_machine == 'x86_64' | ||
nvidia-cublas-cu11 == 11.11.3.6; platform_machine == 'x86_64' | ||
nvidia-cudnn-cu11 == 8.6.0.*; platform_machine == 'x86_64' | ||
onnx==1.14.0; platform_machine == 'x86_64' | ||
protobuf==3.20.3; platform_machine == 'x86_64' |