mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-28 17:53:51 +02:00
Add support for JetPack 6 (#16571)
* it builds! * some fixes * use python 3.11 (rc1) * add deadsnakes ppa for more recent python 3.11 in jetson images * fix pip stuff * revert to tensor 8.6 * revert changes to docker/main * add hook to install deadsnakes ppa for tensorrt/jetson * remove unnecessary pip break-system-packages * move tflite_runtime to requirements-wheels.txt
This commit is contained in:
parent
1d3de77f63
commit
5bd412071a
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
|
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp5
|
||||||
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-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
|
*.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:23.12-py3-igpu
|
||||||
|
SLIM_BASE: nvcr.io/nvidia/tensorrt:23.12-py3-igpu
|
||||||
|
TRT_BASE: nvcr.io/nvidia/tensorrt:23.12-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:
|
amd64_extra_builds:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
name: AMD64 Extra Build
|
name: AMD64 Extra Build
|
||||||
|
@ -3,14 +3,27 @@
|
|||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Globally set pip break-system-packages option to avoid having to specify it every time
|
||||||
|
ARG PIP_BREAK_SYSTEM_PACKAGES=1
|
||||||
|
|
||||||
ARG BASE_IMAGE=debian:12
|
ARG BASE_IMAGE=debian:12
|
||||||
ARG SLIM_BASE=debian:12-slim
|
ARG SLIM_BASE=debian:12-slim
|
||||||
|
|
||||||
|
# A hook that allows us to inject commands right after the base images
|
||||||
|
ARG BASE_HOOK=
|
||||||
|
|
||||||
FROM ${BASE_IMAGE} AS base
|
FROM ${BASE_IMAGE} AS base
|
||||||
|
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||||
|
|
||||||
|
RUN ${BASE_HOOK}
|
||||||
|
|
||||||
FROM --platform=${BUILDPLATFORM} debian:12 AS base_host
|
FROM --platform=${BUILDPLATFORM} debian:12 AS base_host
|
||||||
|
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||||
|
|
||||||
FROM ${SLIM_BASE} AS slim-base
|
FROM ${SLIM_BASE} AS slim-base
|
||||||
|
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||||
|
|
||||||
|
RUN ${BASE_HOOK}
|
||||||
|
|
||||||
FROM slim-base AS wget
|
FROM slim-base AS wget
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
@ -66,8 +79,8 @@ COPY docker/main/requirements-ov.txt /requirements-ov.txt
|
|||||||
RUN apt-get -qq update \
|
RUN apt-get -qq update \
|
||||||
&& apt-get -qq install -y wget python3 python3-dev python3-distutils gcc pkg-config libhdf5-dev \
|
&& apt-get -qq install -y wget python3 python3-dev python3-distutils gcc pkg-config libhdf5-dev \
|
||||||
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
&& python3 get-pip.py "pip" --break-system-packages \
|
&& python3 get-pip.py "pip" \
|
||||||
&& pip install --break-system-packages -r /requirements-ov.txt
|
&& pip install -r /requirements-ov.txt
|
||||||
|
|
||||||
# Get OpenVino Model
|
# Get OpenVino Model
|
||||||
RUN --mount=type=bind,source=docker/main/build_ov_model.py,target=/build_ov_model.py \
|
RUN --mount=type=bind,source=docker/main/build_ov_model.py,target=/build_ov_model.py \
|
||||||
@ -142,8 +155,8 @@ RUN apt-get -qq update \
|
|||||||
apt-transport-https wget \
|
apt-transport-https wget \
|
||||||
&& apt-get -qq update \
|
&& apt-get -qq update \
|
||||||
&& apt-get -qq install -y \
|
&& apt-get -qq install -y \
|
||||||
python3 \
|
python3.11 \
|
||||||
python3-dev \
|
python3.11-dev \
|
||||||
# opencv dependencies
|
# opencv dependencies
|
||||||
build-essential cmake git pkg-config libgtk-3-dev \
|
build-essential cmake git pkg-config libgtk-3-dev \
|
||||||
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
|
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
|
||||||
@ -157,11 +170,13 @@ RUN apt-get -qq update \
|
|||||||
gcc gfortran libopenblas-dev liblapack-dev && \
|
gcc gfortran libopenblas-dev liblapack-dev && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
||||||
|
|
||||||
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
&& python3 get-pip.py "pip" --break-system-packages
|
&& python3 get-pip.py "pip"
|
||||||
|
|
||||||
COPY docker/main/requirements.txt /requirements.txt
|
COPY docker/main/requirements.txt /requirements.txt
|
||||||
RUN pip3 install -r /requirements.txt --break-system-packages
|
RUN pip3 install -r /requirements.txt
|
||||||
|
|
||||||
# Build pysqlite3 from source
|
# Build pysqlite3 from source
|
||||||
COPY docker/main/build_pysqlite3.sh /build_pysqlite3.sh
|
COPY docker/main/build_pysqlite3.sh /build_pysqlite3.sh
|
||||||
@ -215,8 +230,8 @@ RUN --mount=type=bind,source=docker/main/install_deps.sh,target=/deps/install_de
|
|||||||
/deps/install_deps.sh
|
/deps/install_deps.sh
|
||||||
|
|
||||||
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
|
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
|
||||||
python3 -m pip install --upgrade pip --break-system-packages && \
|
python3 -m pip install --upgrade pip && \
|
||||||
pip3 install -U /deps/wheels/*.whl --break-system-packages
|
pip3 install -U /deps/wheels/*.whl
|
||||||
|
|
||||||
COPY --from=deps-rootfs / /
|
COPY --from=deps-rootfs / /
|
||||||
|
|
||||||
@ -263,7 +278,7 @@ RUN apt-get update \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN --mount=type=bind,source=./docker/main/requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
RUN --mount=type=bind,source=./docker/main/requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
||||||
pip3 install -r requirements-dev.txt --break-system-packages
|
pip3 install -r requirements-dev.txt
|
||||||
|
|
||||||
HEALTHCHECK NONE
|
HEALTHCHECK NONE
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ apt-get -qq install --no-install-recommends -y \
|
|||||||
lbzip2 \
|
lbzip2 \
|
||||||
procps vainfo \
|
procps vainfo \
|
||||||
unzip locales tzdata libxml2 xz-utils \
|
unzip locales tzdata libxml2 xz-utils \
|
||||||
python3 \
|
python3.11 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
curl \
|
curl \
|
||||||
lsof \
|
lsof \
|
||||||
@ -21,6 +21,8 @@ apt-get -qq install --no-install-recommends -y \
|
|||||||
libglib2.0-0 \
|
libglib2.0-0 \
|
||||||
libusb-1.0.0
|
libusb-1.0.0
|
||||||
|
|
||||||
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
||||||
|
|
||||||
mkdir -p -m 600 /root/.gnupg
|
mkdir -p -m 600 /root/.gnupg
|
||||||
|
|
||||||
# install coral runtime
|
# install coral runtime
|
||||||
@ -29,15 +31,6 @@ unset DEBIAN_FRONTEND
|
|||||||
yes | dpkg -i /tmp/libedgetpu1-max.deb && export DEBIAN_FRONTEND=noninteractive
|
yes | dpkg -i /tmp/libedgetpu1-max.deb && export DEBIAN_FRONTEND=noninteractive
|
||||||
rm /tmp/libedgetpu1-max.deb
|
rm /tmp/libedgetpu1-max.deb
|
||||||
|
|
||||||
# install python3 & tflite runtime
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|
||||||
pip3 install --break-system-packages https://github.com/frigate-nvr/TFlite-builds/releases/download/v2.17.1/tflite_runtime-2.17.1-cp311-cp311-linux_x86_64.whl
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
|
||||||
pip3 install --break-system-packages https://github.com/feranick/TFlite-builds/releases/download/v2.17.1/tflite_runtime-2.17.1-cp311-cp311-linux_aarch64.whl
|
|
||||||
fi
|
|
||||||
|
|
||||||
# btbn-ffmpeg -> amd64
|
# btbn-ffmpeg -> amd64
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||||
mkdir -p /usr/lib/ffmpeg/5.0
|
mkdir -p /usr/lib/ffmpeg/5.0
|
||||||
|
@ -68,4 +68,7 @@ netaddr==0.8.*
|
|||||||
netifaces==0.10.*
|
netifaces==0.10.*
|
||||||
verboselogs==1.7.*
|
verboselogs==1.7.*
|
||||||
virtualenv==20.17.*
|
virtualenv==20.17.*
|
||||||
prometheus-client == 0.21.*
|
prometheus-client == 0.21.*
|
||||||
|
# TFLite
|
||||||
|
tflite_runtime @ https://github.com/feranick/TFlite-builds/releases/download/v2.17.1/tflite_runtime-2.17.1-cp311-cp311-linux_x86_64.whl; platform_machine == 'x86_64'
|
||||||
|
tflite_runtime @ https://github.com/feranick/TFlite-builds/releases/download/v2.17.1/tflite_runtime-2.17.1-cp311-cp311-linux_aarch64.whl; platform_machine == 'aarch64'
|
||||||
|
@ -8,7 +8,6 @@ COPY docker/main/requirements-wheels.txt /requirements-wheels.txt
|
|||||||
COPY docker/rockchip/requirements-wheels-rk.txt /requirements-wheels-rk.txt
|
COPY docker/rockchip/requirements-wheels-rk.txt /requirements-wheels-rk.txt
|
||||||
RUN sed -i "/https:\/\//d" /requirements-wheels.txt
|
RUN sed -i "/https:\/\//d" /requirements-wheels.txt
|
||||||
RUN sed -i "/onnxruntime/d" /requirements-wheels.txt
|
RUN sed -i "/onnxruntime/d" /requirements-wheels.txt
|
||||||
RUN python3 -m pip config set global.break-system-packages true
|
|
||||||
RUN pip3 wheel --wheel-dir=/rk-wheels -c /requirements-wheels.txt -r /requirements-wheels-rk.txt
|
RUN pip3 wheel --wheel-dir=/rk-wheels -c /requirements-wheels.txt -r /requirements-wheels-rk.txt
|
||||||
RUN rm -rf /rk-wheels/opencv_python-*
|
RUN rm -rf /rk-wheels/opencv_python-*
|
||||||
|
|
||||||
@ -16,7 +15,7 @@ FROM deps AS rk-frigate
|
|||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
RUN --mount=type=bind,from=rk-wheels,source=/rk-wheels,target=/deps/rk-wheels \
|
RUN --mount=type=bind,from=rk-wheels,source=/rk-wheels,target=/deps/rk-wheels \
|
||||||
pip3 install --no-deps -U /deps/rk-wheels/*.whl --break-system-packages
|
pip3 install --no-deps -U /deps/rk-wheels/*.whl
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
COPY --from=rootfs / /
|
COPY --from=rootfs / /
|
||||||
|
@ -17,7 +17,7 @@ FROM tensorrt-base AS frigate-tensorrt
|
|||||||
ENV TRT_VER=8.6.1
|
ENV TRT_VER=8.6.1
|
||||||
RUN python3 -m pip config set global.break-system-packages true
|
RUN python3 -m pip config set global.break-system-packages true
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
pip3 install -U /deps/trt-wheels/*.whl --break-system-packages && \
|
pip3 install -U /deps/trt-wheels/*.whl && \
|
||||||
ldconfig
|
ldconfig
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
@ -32,4 +32,4 @@ COPY --from=trt-deps /usr/local/cuda-12.1 /usr/local/cuda
|
|||||||
COPY docker/tensorrt/detector/rootfs/ /
|
COPY docker/tensorrt/detector/rootfs/ /
|
||||||
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
pip3 install -U /deps/trt-wheels/*.whl --break-system-packages
|
pip3 install -U /deps/trt-wheels/*.whl
|
||||||
|
@ -7,20 +7,25 @@ ARG BASE_IMAGE
|
|||||||
FROM ${BASE_IMAGE} AS build-wheels
|
FROM ${BASE_IMAGE} AS build-wheels
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
|
# Add deadsnakes PPA for python3.11
|
||||||
|
RUN apt-get -qq update && \
|
||||||
|
apt-get -qq install -y --no-install-recommends \
|
||||||
|
software-properties-common \
|
||||||
|
&& add-apt-repository ppa:deadsnakes/ppa
|
||||||
|
|
||||||
# Use a separate container to build wheels to prevent build dependencies in final image
|
# Use a separate container to build wheels to prevent build dependencies in final image
|
||||||
RUN apt-get -qq update \
|
RUN apt-get -qq update \
|
||||||
&& apt-get -qq install -y --no-install-recommends \
|
&& apt-get -qq install -y --no-install-recommends \
|
||||||
python3.9 python3.9-dev \
|
python3.11 python3.11-dev \
|
||||||
wget build-essential cmake git \
|
wget build-essential cmake git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Ensure python3 defaults to python3.9
|
# Ensure python3 defaults to python3.11
|
||||||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
||||||
|
|
||||||
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
&& python3 get-pip.py "pip"
|
&& python3 get-pip.py "pip"
|
||||||
|
|
||||||
|
|
||||||
FROM build-wheels AS trt-wheels
|
FROM build-wheels AS trt-wheels
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
@ -41,11 +46,12 @@ RUN --mount=type=bind,source=docker/tensorrt/detector/build_python_tensorrt.sh,t
|
|||||||
&& TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh
|
&& TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh
|
||||||
|
|
||||||
COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt
|
COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt
|
||||||
ADD https://nvidia.box.com/shared/static/psl23iw3bh7hlgku0mjo1xekxpego3e3.whl /tmp/onnxruntime_gpu-1.15.1-cp311-cp311-linux_aarch64.whl
|
# See https://elinux.org/Jetson_Zoo#ONNX_Runtime
|
||||||
|
ADD https://nvidia.box.com/shared/static/9yvw05k6u343qfnkhdv2x6xhygze0aq1.whl /tmp/onnxruntime_gpu-1.19.0-cp311-cp311-linux_aarch64.whl
|
||||||
|
|
||||||
RUN pip3 uninstall -y onnxruntime-openvino \
|
RUN pip3 uninstall -y onnxruntime-openvino \
|
||||||
&& pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt \
|
&& pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt \
|
||||||
&& pip3 install --no-deps /tmp/onnxruntime_gpu-1.15.1-cp311-cp311-linux_aarch64.whl
|
&& pip3 install --no-deps /tmp/onnxruntime_gpu-1.19.0-cp311-cp311-linux_aarch64.whl
|
||||||
|
|
||||||
FROM build-wheels AS trt-model-wheels
|
FROM build-wheels AS trt-model-wheels
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
@ -67,12 +73,18 @@ RUN --mount=type=bind,source=docker/tensorrt/build_jetson_ffmpeg.sh,target=/deps
|
|||||||
# Frigate w/ TensorRT for NVIDIA Jetson platforms
|
# Frigate w/ TensorRT for NVIDIA Jetson platforms
|
||||||
FROM tensorrt-base AS frigate-tensorrt
|
FROM tensorrt-base AS frigate-tensorrt
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y python-is-python3 libprotobuf17 \
|
&& apt-get install -y python-is-python3 libprotobuf23 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN rm -rf /usr/lib/btbn-ffmpeg/
|
RUN rm -rf /usr/lib/btbn-ffmpeg/
|
||||||
COPY --from=jetson-ffmpeg /rootfs /
|
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
|
COPY --from=trt-wheels /etc/TENSORRT_VER /etc/TENSORRT_VER
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
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 \
|
--mount=type=bind,from=trt-model-wheels,source=/trt-model-wheels,target=/deps/trt-model-wheels \
|
||||||
@ -81,3 +93,6 @@ RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels
|
|||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
COPY --from=rootfs / /
|
COPY --from=rootfs / /
|
||||||
|
|
||||||
|
# Fixes "Error importing detector runtime: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: cannot allocate memory in static TLS block"
|
||||||
|
ENV LD_PRELOAD /usr/lib/aarch64-linux-gnu/libstdc++.so.6
|
||||||
|
@ -14,14 +14,27 @@ apt-get -qq install -y --no-install-recommends libx264-dev libx265-dev
|
|||||||
pushd /tmp
|
pushd /tmp
|
||||||
|
|
||||||
# Install libnvmpi to enable nvmpi decoders (h264_nvmpi, hevc_nvmpi)
|
# Install libnvmpi to enable nvmpi decoders (h264_nvmpi, hevc_nvmpi)
|
||||||
if [ -e /usr/local/cuda-10.2 ]; then
|
if [ -e /usr/local/cuda-12 ]; then
|
||||||
|
# assume Jetpack 6.2
|
||||||
|
apt-key adv --fetch-key https://repo.download.nvidia.com/jetson/jetson-ota-public.asc
|
||||||
|
echo "deb https://repo.download.nvidia.com/jetson/common r36.4 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
|
||||||
|
echo "deb https://repo.download.nvidia.com/jetson/t234 r36.4 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
|
||||||
|
echo "deb https://repo.download.nvidia.com/jetson/ffmpeg r36.4 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
|
||||||
|
|
||||||
|
mkdir -p /opt/nvidia/l4t-packages/
|
||||||
|
touch /opt/nvidia/l4t-packages/.nv-l4t-disable-boot-fw-update-in-preinstall
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get -qq install -y --no-install-recommends -o Dpkg::Options::="--force-confold" nvidia-l4t-jetson-multimedia-api
|
||||||
|
elif [ -e /usr/local/cuda-10.2 ]; then
|
||||||
# assume Jetpack 4.X
|
# assume Jetpack 4.X
|
||||||
wget -q https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/T186/Jetson_Multimedia_API_R32.5.0_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
wget -q https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/T186/Jetson_Multimedia_API_R32.5.0_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
||||||
|
tar xaf jetson_multimedia_api.tbz2 -C / && rm jetson_multimedia_api.tbz2
|
||||||
else
|
else
|
||||||
# assume Jetpack 5.X
|
# assume Jetpack 5.X
|
||||||
wget -q https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v3.1/release/jetson_multimedia_api_r35.3.1_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
wget -q https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v3.1/release/jetson_multimedia_api_r35.3.1_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
||||||
|
tar xaf jetson_multimedia_api.tbz2 -C / && rm jetson_multimedia_api.tbz2
|
||||||
fi
|
fi
|
||||||
tar xaf jetson_multimedia_api.tbz2 -C / && rm jetson_multimedia_api.tbz2
|
|
||||||
|
|
||||||
wget -q https://github.com/AndBobsYourUncle/jetson-ffmpeg/archive/9c17b09.zip -O jetson-ffmpeg.zip
|
wget -q https://github.com/AndBobsYourUncle/jetson-ffmpeg/archive/9c17b09.zip -O jetson-ffmpeg.zip
|
||||||
unzip jetson-ffmpeg.zip && rm jetson-ffmpeg.zip && mv jetson-ffmpeg-* jetson-ffmpeg && cd jetson-ffmpeg
|
unzip jetson-ffmpeg.zip && rm jetson-ffmpeg.zip && mv jetson-ffmpeg-* jetson-ffmpeg && cd jetson-ffmpeg
|
||||||
|
@ -6,23 +6,23 @@ mkdir -p /trt-wheels
|
|||||||
|
|
||||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||||
|
|
||||||
# NVIDIA supplies python-tensorrt for python3.8, but frigate uses python3.9,
|
# NVIDIA supplies python-tensorrt for python3.10, but frigate uses python3.11,
|
||||||
# so we must build python-tensorrt ourselves.
|
# so we must build python-tensorrt ourselves.
|
||||||
|
|
||||||
# Get python-tensorrt source
|
# Get python-tensorrt source
|
||||||
mkdir /workspace
|
mkdir -p /workspace
|
||||||
cd /workspace
|
cd /workspace
|
||||||
git clone -b ${TENSORRT_VER} https://github.com/NVIDIA/TensorRT.git --depth=1
|
git clone -b release/8.6 https://github.com/NVIDIA/TensorRT.git --depth=1
|
||||||
|
|
||||||
# Collect dependencies
|
# Collect dependencies
|
||||||
EXT_PATH=/workspace/external && mkdir -p $EXT_PATH
|
EXT_PATH=/workspace/external && mkdir -p $EXT_PATH
|
||||||
pip3 install pybind11 && ln -s /usr/local/lib/python3.9/dist-packages/pybind11 $EXT_PATH/pybind11
|
pip3 install pybind11 && ln -s /usr/local/lib/python3.11/dist-packages/pybind11 $EXT_PATH/pybind11
|
||||||
ln -s /usr/include/python3.9 $EXT_PATH/python3.9
|
ln -s /usr/include/python3.11 $EXT_PATH/python3.11
|
||||||
ln -s /usr/include/aarch64-linux-gnu/NvOnnxParser.h /workspace/TensorRT/parsers/onnx/
|
ln -s /usr/include/aarch64-linux-gnu/NvOnnxParser.h /workspace/TensorRT/parsers/onnx/
|
||||||
|
|
||||||
# Build wheel
|
# Build wheel
|
||||||
cd /workspace/TensorRT/python
|
cd /workspace/TensorRT/python
|
||||||
EXT_PATH=$EXT_PATH PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=9 TARGET_ARCHITECTURE=aarch64 /bin/bash ./build.sh
|
EXT_PATH=$EXT_PATH PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=11 TARGET_ARCHITECTURE=aarch64 TENSORRT_MODULE=tensorrt /bin/bash ./build.sh
|
||||||
mv build/dist/*.whl /trt-wheels/
|
mv build/bindings_wheel/dist/*.whl /trt-wheels/
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -1 +1 @@
|
|||||||
cuda-python == 11.7; platform_machine == 'aarch64'
|
cuda-python == 12.6.*; platform_machine == 'aarch64'
|
||||||
|
@ -13,13 +13,24 @@ variable "TRT_BASE" {
|
|||||||
variable "COMPUTE_LEVEL" {
|
variable "COMPUTE_LEVEL" {
|
||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
variable "BASE_HOOK" {
|
||||||
|
# Ensure an up-to-date python 3.11 is available in tensorrt/jetson image
|
||||||
|
default = <<EOT
|
||||||
|
if grep -iq \"ubuntu\" /etc/os-release; then
|
||||||
|
apt-get update &&
|
||||||
|
apt-get install -y software-properties-common &&
|
||||||
|
add-apt-repository ppa:deadsnakes/ppa;
|
||||||
|
fi
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
|
||||||
target "_build_args" {
|
target "_build_args" {
|
||||||
args = {
|
args = {
|
||||||
BASE_IMAGE = BASE_IMAGE,
|
BASE_IMAGE = BASE_IMAGE,
|
||||||
SLIM_BASE = SLIM_BASE,
|
SLIM_BASE = SLIM_BASE,
|
||||||
TRT_BASE = TRT_BASE,
|
TRT_BASE = TRT_BASE,
|
||||||
COMPUTE_LEVEL = COMPUTE_LEVEL
|
COMPUTE_LEVEL = COMPUTE_LEVEL,
|
||||||
|
BASE_HOOK = BASE_HOOK
|
||||||
}
|
}
|
||||||
platforms = ["linux/${ARCH}"]
|
platforms = ["linux/${ARCH}"]
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@ BOARDS += trt
|
|||||||
|
|
||||||
JETPACK4_BASE ?= timongentzsch/l4t-ubuntu20-opencv:latest # L4T 32.7.1 JetPack 4.6.1
|
JETPACK4_BASE ?= timongentzsch/l4t-ubuntu20-opencv:latest # L4T 32.7.1 JetPack 4.6.1
|
||||||
JETPACK5_BASE ?= nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime # L4T 35.3.1 JetPack 5.1.1
|
JETPACK5_BASE ?= nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime # L4T 35.3.1 JetPack 5.1.1
|
||||||
|
JETPACK6_BASE ?= nvcr.io/nvidia/tensorrt:23.12-py3-igpu
|
||||||
X86_DGPU_ARGS := ARCH=amd64 COMPUTE_LEVEL="50 60 70 80 90"
|
X86_DGPU_ARGS := ARCH=amd64 COMPUTE_LEVEL="50 60 70 80 90"
|
||||||
JETPACK4_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK4_BASE) SLIM_BASE=$(JETPACK4_BASE) TRT_BASE=$(JETPACK4_BASE)
|
JETPACK4_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK4_BASE) SLIM_BASE=$(JETPACK4_BASE) TRT_BASE=$(JETPACK4_BASE)
|
||||||
JETPACK5_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK5_BASE) SLIM_BASE=$(JETPACK5_BASE) TRT_BASE=$(JETPACK5_BASE)
|
JETPACK5_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK5_BASE) SLIM_BASE=$(JETPACK5_BASE) TRT_BASE=$(JETPACK5_BASE)
|
||||||
|
JETPACK6_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK6_BASE) SLIM_BASE=$(JETPACK6_BASE) TRT_BASE=$(JETPACK6_BASE)
|
||||||
|
|
||||||
local-trt: version
|
local-trt: version
|
||||||
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
@ -21,6 +23,11 @@ local-trt-jp5: version
|
|||||||
--set tensorrt.tags=frigate:latest-tensorrt-jp5 \
|
--set tensorrt.tags=frigate:latest-tensorrt-jp5 \
|
||||||
--load
|
--load
|
||||||
|
|
||||||
|
local-trt-jp6: version
|
||||||
|
$(JETPACK6_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
|
--set tensorrt.tags=frigate:latest-tensorrt-jp6 \
|
||||||
|
--load
|
||||||
|
|
||||||
build-trt:
|
build-trt:
|
||||||
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt
|
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt
|
||||||
@ -28,6 +35,8 @@ build-trt:
|
|||||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4
|
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4
|
||||||
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5
|
--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
|
push-trt: build-trt
|
||||||
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
@ -39,3 +48,6 @@ push-trt: build-trt
|
|||||||
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl tensorrt \
|
||||||
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 \
|
--set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 \
|
||||||
--push
|
--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