diff --git a/Dockerfile b/Dockerfile index 92608a133..c87baba0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -128,20 +128,27 @@ RUN /bin/mkdir -p '/usr/local/lib' && \ # # TensorRT Support # -# 1. Build the pycuda wheel for cp39-x86_64 -# 2. Download and convert a model for the tensorRT runtime +# 1. Download and convert a model for the tensorRT runtime # #### -# Build CUDA Python Bindings for Python 3.9 -# FROM wget as pycuda-build -# ARG DEBIAN_FRONTEND - -# RUN --mount=type=bind,source=docker/build_pycuda.sh,target=/build/build_pycuda.sh \ -# /build/build_pycuda.sh # Download and Convert TensorRT Model # FROM base_amd64 as tensorrt-converter -## TODO + +# RUN apt-get update && apt-get install -y --no-install-recommends git sudo software-properties-common \ +# cmake build-essential unzip python3.9-dev libnvinfer-dev python-is-python3 libnvparsers-dev libnvinfer-plugin-dev + +# RUN git clone https://github.com/jkjung-avt/tensorrt_demos.git /tensorrt_demos + +# ENV CUDA_HOME=/usr/local/cuda +# ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 +# ENV PATH=$PATH:$CUDA_HOME/bin +# RUN python3 -m pip install --upgrade pip +# # ADD install_protobuf.sh /install_protobuf.sh +# # RUN /install_protobuf.sh +# RUN pip3 install cython protobuf onnx==1.4.1 +# RUN cd /tensorrt_demos/yolo && ./download_yolo.sh +# ADD run.sh /run.sh diff --git a/docker/install_tensorrt.sh b/docker/install_tensorrt.sh index e587cce64..ff84de118 100755 --- a/docker/install_tensorrt.sh +++ b/docker/install_tensorrt.sh @@ -2,12 +2,13 @@ set -euxo pipefail -"${CUDA_LIB_VERSION:=11.8}" -"${CUDA_PKG_VERSION:=11-8}" -"${CUDNN_VERSION:=8.6.0.84}" -"${TENSORRT_VERSION:=7.2.2}" +echo "${CUDA_LIB_VERSION:=11.8}" +echo "${CUDA_PKG_VERSION:=11-8}" +echo "${CUDNN_VERSION:=8.6.0.84}" +echo "${TENSORRT_VERSION:=8.5.1}" # Add NVidia Repo +apt-get -qq update && apt-get install -y --no-install-recommends software-properties-common # wget -q -O - https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/3bf863cc.pub | apt-key add - # echo "deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /" | tee /etc/apt/sources.list.d/nvidia-cuda.list wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb @@ -19,8 +20,8 @@ apt-get -qq update apt-get install -y --no-install-recommends \ cuda-cudart-${CUDA_PKG_VERSION} \ cuda-compat-${CUDA_PKG_VERSION} \ - cuda-cupti-${CUDA_PKG_VERSION} && \ - ln -s cuda-${CUDA_LIB_VERSION} /usr/local/cuda + cuda-cupti-${CUDA_PKG_VERSION} +#ln -s cuda-${CUDA_LIB_VERSION} /usr/local/cuda # CUDA Runtime apt-get install -y --no-install-recommends \ @@ -35,4 +36,8 @@ apt-get install -y --no-install-recommends \ # TensorRT Runtime apt-get install -y --no-install-recommends \ - libvinfer + tensorrt-libs python3-libnvinfer + +# apt-get clean autoclean -y +# apt-get autoremove --purge -y +# rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/frigate/detectors/tensorrt.py b/frigate/detectors/tensorrt.py index 8e4b66aa0..32289fbff 100644 --- a/frigate/detectors/tensorrt.py +++ b/frigate/detectors/tensorrt.py @@ -65,7 +65,7 @@ class TensorRtDetector(DetectionApi): outputs = [] bindings = [] output_idx = 0 - stream = cuda.Stream() + stream = cuda.cuStream() for binding in self.engine: binding_dims = self.engine.get_binding_shape(binding) if len(binding_dims) == 4: diff --git a/requirements-tensorrt.txt b/requirements-tensorrt.txt index e36fd6b18..134960075 100644 --- a/requirements-tensorrt.txt +++ b/requirements-tensorrt.txt @@ -2,4 +2,8 @@ cuda-python == 11.8.* tensorrt == 8.5.* nvidia-cuda-runtime-cu11 == 11.8.* nvidia-cublas-cu11 == 11.11.* -nvidia-cudnn-cu11 == 8.7.* \ No newline at end of file +nvidia-cudnn-cu11 == 8.7.* +pyindex-nvidia +polygraphy-trtexec +# tensorflow +# easydict \ No newline at end of file