mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-25 18:55:25 -06:00
some fixes
This commit is contained in:
parent
200d08871b
commit
2a05429a6d
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@ -136,6 +136,35 @@ jobs:
|
||||
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp5
|
||||
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5
|
||||
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5,mode=max
|
||||
jetson_jp6_build:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Jetson Jetpack 6
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up QEMU and Buildx
|
||||
id: setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push TensorRT (Jetson, Jetpack 6)
|
||||
env:
|
||||
ARCH: arm64
|
||||
BASE_IMAGE: nvcr.io/nvidia/tensorrt:24.08-py3-igpu
|
||||
SLIM_BASE: nvcr.io/nvidia/tensorrt:24.08-py3-igpu
|
||||
TRT_BASE: nvcr.io/nvidia/tensorrt:24.08-py3-igpu
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
source: .
|
||||
push: true
|
||||
targets: tensorrt
|
||||
files: docker/tensorrt/trt.hcl
|
||||
set: |
|
||||
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp6
|
||||
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6
|
||||
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp6,mode=max
|
||||
amd64_extra_builds:
|
||||
runs-on: ubuntu-22.04
|
||||
name: AMD64 Extra Build
|
||||
|
@ -61,6 +61,12 @@ RUN apt-get update \
|
||||
RUN rm -rf /usr/lib/btbn-ffmpeg/
|
||||
COPY --from=jetson-ffmpeg /rootfs /
|
||||
|
||||
# ffmpeg runtime dependencies
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends \
|
||||
libx264-163 libx265-199 libegl1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=trt-wheels /etc/TENSORRT_VER /etc/TENSORRT_VER
|
||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||
--mount=type=bind,from=trt-model-wheels,source=/trt-model-wheels,target=/deps/trt-model-wheels \
|
||||
|
@ -14,6 +14,7 @@ RUN apt-get update \
|
||||
&& apt-get install -y git build-essential cuda-nvcc-* cuda-nvtx-* libnvinfer-dev libnvinfer-plugin-dev libnvonnxparsers-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target=/tensorrt_libyolo.sh \
|
||||
--mount=type=bind,source=docker/tensorrt/detector/0001-fix-for-tensorrt-v10.3.0.patch,target=/0001-fix-for-tensorrt-v10.3.0.patch \
|
||||
/tensorrt_libyolo.sh
|
||||
|
||||
# Frigate w/ TensorRT Support as separate image
|
||||
|
40
docker/tensorrt/detector/0001-fix-for-tensorrt-v10.3.0.patch
Normal file
40
docker/tensorrt/detector/0001-fix-for-tensorrt-v10.3.0.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 21eb9bbcd35fd9eed8b5365ed7b43853486fd8a0 Mon Sep 17 00:00:00 2001
|
||||
From: Lander Noterman <lander.noterman@basalte.be>
|
||||
Date: Thu, 13 Feb 2025 13:52:19 +0100
|
||||
Subject: [PATCH] fix for tensorrt v10.3.0
|
||||
|
||||
---
|
||||
plugins/Makefile | 2 +-
|
||||
yolo/onnx_to_tensorrt.py | 9 +++++----
|
||||
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/plugins/Makefile b/plugins/Makefile
|
||||
index 51af1cd..d7cea4c 100644
|
||||
--- a/plugins/Makefile
|
||||
+++ b/plugins/Makefile
|
||||
@@ -21,7 +21,7 @@ TENSORRT_LIBS=-L"/usr/local/TensorRT-7.1.3.4/lib"
|
||||
|
||||
# INCS and LIBS
|
||||
INCS=-I"/usr/local/cuda/include" $(TENSORRT_INCS) -I"/usr/local/include" -I"plugin"
|
||||
-LIBS=-L"/usr/local/cuda/lib64" $(TENSORRT_LIBS) -L"/usr/local/lib" -Wl,--start-group -lnvinfer -lnvparsers -lnvinfer_plugin -lcudnn -lcublas -lnvToolsExt -lcudart -lrt -ldl -lpthread -Wl,--end-group
|
||||
+LIBS=-L"/usr/local/cuda/lib64" $(TENSORRT_LIBS) -L"/usr/local/lib" -Wl,--start-group -lnvinfer -lnvinfer_plugin -lcudnn -lcublas -lnvToolsExt -lcudart -lrt -ldl -lpthread -Wl,--end-group
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
diff --git a/yolo/onnx_to_tensorrt.py b/yolo/onnx_to_tensorrt.py
|
||||
index 77862db..06d0759 100644
|
||||
--- a/yolo/onnx_to_tensorrt.py
|
||||
+++ b/yolo/onnx_to_tensorrt.py
|
||||
@@ -194,7 +193,9 @@ def build_engine(model_name, do_int8, dla_core, verbose=False):
|
||||
if dla_core >= 0:
|
||||
config.default_device_type = trt.DeviceType.DLA
|
||||
config.DLA_core = dla_core
|
||||
- config.set_flag(trt.BuilderFlag.STRICT_TYPES)
|
||||
+ config.set_flag(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
|
||||
+ config.set_flag(trt.BuilderFlag.DIRECT_IO)
|
||||
+ config.set_flag(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)
|
||||
print('Using DLA core %d.' % dla_core)
|
||||
engine = builder.build_serialized_network(network, config)
|
||||
|
||||
--
|
||||
2.48.1
|
@ -62,15 +62,14 @@ fi
|
||||
# container which should not be present in the image - if they are, TRT model generation will
|
||||
# fail or produce invalid models. Thus we must request the user to install them on the host in
|
||||
# order to run libyolo here.
|
||||
# On Jetpack 5.0, these libraries are not mounted by the runtime and are supplied by the image.
|
||||
# On Jetpack 5.0+, these libraries are not mounted by the runtime and are supplied by the image.
|
||||
if [[ "$(arch)" == "aarch64" ]]; then
|
||||
if [[ ! -e /usr/lib/aarch64-linux-gnu/tegra ]]; then
|
||||
if [[ ! -e /usr/lib/aarch64-linux-gnu/tegra && ! -e /usr/lib/aarch64-linux-gnu/tegra-egl ]]; then
|
||||
echo "ERROR: Container must be launched with nvidia runtime"
|
||||
exit 1
|
||||
elif [[ ! -e /usr/lib/aarch64-linux-gnu/libnvinfer.so.8 ||
|
||||
! -e /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.8 ||
|
||||
! -e /usr/lib/aarch64-linux-gnu/libnvparsers.so.8 ||
|
||||
! -e /usr/lib/aarch64-linux-gnu/libnvonnxparser.so.8 ]]; then
|
||||
elif [[ ! -e /usr/lib/aarch64-linux-gnu/libnvinfer.so ||
|
||||
! -e /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so ||
|
||||
! -e /usr/lib/aarch64-linux-gnu/libnvonnxparser.so ]]; then
|
||||
echo "ERROR: Please run the following on the HOST:"
|
||||
echo " sudo apt install libnvinfer8 libnvinfer-plugin8 libnvparsers8 libnvonnxparsers8 nvidia-container"
|
||||
exit 1
|
||||
|
@ -7,8 +7,9 @@ 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
|
||||
|
||||
# remove -lnvparsers
|
||||
sed -i 's/-lnvparsers//g' ./tensorrt_demos/plugins/Makefile
|
||||
# Should probably upstream this patch or fork the repo
|
||||
# See: https://developer.nvidia.com/docs/drive/drive-os/6.0.8/public/drive-os-tensorrt/api-reference/docs/python/infer/Core/BuilderConfig.html#tensorrt.BuilderFlag
|
||||
git apply --directory tensorrt_demos /0001-fix-for-tensorrt-v10.3.0.patch
|
||||
|
||||
# Build libyolo
|
||||
if [ ! -e /usr/local/cuda ]; then
|
||||
|
@ -35,6 +35,8 @@ build-trt:
|
||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4
|
||||
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5
|
||||
$(JETPACK6_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp6
|
||||
|
||||
push-trt: build-trt
|
||||
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||
@ -46,3 +48,6 @@ push-trt: build-trt
|
||||
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 \
|
||||
--push
|
||||
$(JETPACK6_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp6 \
|
||||
--push
|
||||
|
Loading…
Reference in New Issue
Block a user