mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
44d8cdbba1
* ROCm AMD/GPU based build and detector, WIP * detectors/rocm: separate yolov8 postprocessing into own function; fix box scaling; use cv2.dnn.blobForImage for preprocessing; assert on required model parameters * AMD/ROCm: add couple of more ultralytics models; comments * docker/rocm: make imported model files readable by all * docker/rocm: readme about running on AMD GPUs * docker/rocm: updated README * docker/rocm: updated README * docker/rocm: updated README * detectors/rocm: separated preprocessing functions into yolo_utils.py * detector/plugins: added onnx cpu plugin * docker/rocm: updated container with limite label sets * example detectors view * docker/rocm: updated README.md * docker/rocm: update README.md * docker/rocm: do not set HSA_OVERRIDE_GFX_VERSION at all for the general version as the empty value broke rocm * detectors: simplified/optimized yolov8_postprocess * detector/yolo_utils: indentation, remove unused variable * detectors/rocm: default option to conserve cpu usage at the expense of latency * detectors/yolo_utils: use nms to prefilter overlapping boxes if too many detected * detectors/edgetpu_tfl: add support for yolov8 * util/download_models: script to download yolov8 model files * docker/main: add download-models overlay into s6 startup * detectors/rocm: assume models are in /config/model_cache/yolov8/ * docker/rocm: compile onnx files into mxr files at startup * switch model download into bash script * detectors/rocm: automatically override HSA_OVERRIDE_GFX_VERSION for couple of known chipsets * docs: rocm detector first notes * typos * describe builds (harakas temporary) * docker/rocm: also build a version for gfx1100 * docker/rocm: use cp instead of tar * docker.rocm: remove README as it is now in detector config * frigate/detectors: renamed yolov8_preprocess->preprocess, pass input tensor element type * docker/main: use newer openvino (2023.3.0) * detectors: implement class aggregation * update yolov8 model * add openvino/yolov8 support for label aggregation * docker: remove pointless s6/timeout-up files * Revert "detectors: implement class aggregation" This reverts commitdcfe6bbf6f
. * detectors/openvino: remove class aggregation * detectors: increase yolov8 postprocessing score trershold to 0.5 * docker/rocm: separate rocm distributed files into its own build stage * Update object_detectors.md * updated CODEOWNERS file for rocm * updated build names for documentation * Revert "docker/main: use newer openvino (2023.3.0)" This reverts commitdee95de908
. * reverrted openvino detector * reverted edgetpu detector * scratched rocm docs from any mention of edgetpu or openvino * Update docs/docs/configuration/object_detectors.md Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * renamed frigate.detectors.yolo_utils.py -> frigate.detectors.util.py * clarified rocm example performance * Improved wording and clarified text * Mentioned rocm detector for AMD GPUs * applied ruff formating * applied ruff suggested fixes * docker/rocm: fix missing argument resulting in larger docker image sizes * docs/configuration/object_detectors: fix links to yolov8 release files --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
107 lines
3.3 KiB
Docker
107 lines
3.3 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
|
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ARG ROCM=5.7.3
|
|
ARG AMDGPU=gfx900
|
|
ARG HSA_OVERRIDE_GFX_VERSION
|
|
ARG HSA_OVERRIDE
|
|
|
|
#######################################################################
|
|
FROM ubuntu:focal as rocm
|
|
|
|
ARG ROCM
|
|
|
|
RUN apt-get update && apt-get -y upgrade
|
|
RUN apt-get -y install gnupg wget
|
|
|
|
RUN mkdir --parents --mode=0755 /etc/apt/keyrings
|
|
|
|
RUN wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null
|
|
COPY docker/rocm/rocm.list /etc/apt/sources.list.d/
|
|
COPY docker/rocm/rocm-pin-600 /etc/apt/preferences.d/
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get -y install --no-install-recommends migraphx
|
|
RUN apt-get -y install --no-install-recommends migraphx-dev
|
|
|
|
RUN mkdir -p /opt/rocm-dist/opt/rocm-$ROCM/lib
|
|
RUN cd /opt/rocm-$ROCM/lib && cp -dpr libMIOpen*.so* libamd*.so* libhip*.so* libhsa*.so* libmigraphx*.so* librocm*.so* librocblas*.so* /opt/rocm-dist/opt/rocm-$ROCM/lib/
|
|
RUN cd /opt/rocm-dist/opt/ && ln -s rocm-$ROCM rocm
|
|
|
|
RUN mkdir -p /opt/rocm-dist/etc/ld.so.conf.d/
|
|
RUN echo /opt/rocm/lib|tee /opt/rocm-dist/etc/ld.so.conf.d/rocm.conf
|
|
|
|
#######################################################################
|
|
FROM --platform=linux/amd64 debian:11 as debian-base
|
|
|
|
RUN apt-get update && apt-get -y upgrade
|
|
RUN apt-get -y install --no-install-recommends libelf1 libdrm2 libdrm-amdgpu1 libnuma1 kmod
|
|
|
|
RUN apt-get -y install python3
|
|
|
|
#######################################################################
|
|
# ROCm does not come with migraphx wrappers for python 3.9, so we build it here
|
|
FROM debian-base as debian-build
|
|
|
|
ARG ROCM
|
|
|
|
COPY --from=rocm /opt/rocm-$ROCM /opt/rocm-$ROCM
|
|
RUN ln -s /opt/rocm-$ROCM /opt/rocm
|
|
|
|
RUN apt-get -y install g++ cmake
|
|
RUN apt-get -y install python3-pybind11 python3.9-distutils python3-dev
|
|
|
|
WORKDIR /opt/build
|
|
|
|
COPY docker/rocm/migraphx .
|
|
|
|
RUN mkdir build && cd build && cmake .. && make install
|
|
|
|
#######################################################################
|
|
FROM deps AS deps-prelim
|
|
|
|
# need this to install libnuma1
|
|
RUN apt-get update
|
|
# no ugprade?!?!
|
|
RUN apt-get -y install libnuma1
|
|
|
|
WORKDIR /opt/frigate/
|
|
COPY --from=rootfs / /
|
|
COPY docker/rocm/rootfs/ /
|
|
|
|
#######################################################################
|
|
FROM scratch AS rocm-dist
|
|
|
|
ARG ROCM
|
|
ARG AMDGPU
|
|
|
|
COPY --from=rocm /opt/rocm-$ROCM/bin/rocminfo /opt/rocm-$ROCM/bin/migraphx-driver /opt/rocm-$ROCM/bin/
|
|
COPY --from=rocm /opt/rocm-$ROCM/share/miopen/db/*$AMDGPU* /opt/rocm-$ROCM/share/miopen/db/
|
|
COPY --from=rocm /opt/rocm-$ROCM/lib/rocblas/library/*$AMDGPU* /opt/rocm-$ROCM/lib/rocblas/library/
|
|
COPY --from=rocm /opt/rocm-dist/ /
|
|
COPY --from=debian-build /opt/rocm/lib/migraphx.cpython-39-x86_64-linux-gnu.so /opt/rocm-$ROCM/lib/
|
|
|
|
#######################################################################
|
|
FROM deps-prelim AS rocm-prelim-hsa-override0
|
|
|
|
ENV HSA_ENABLE_SDMA=0
|
|
|
|
COPY --from=rocm-dist / /
|
|
|
|
RUN ldconfig
|
|
|
|
#######################################################################
|
|
FROM rocm-prelim-hsa-override0 as rocm-prelim-hsa-override1
|
|
|
|
ARG HSA_OVERRIDE_GFX_VERSION
|
|
ENV HSA_OVERRIDE_GFX_VERSION=$HSA_OVERRIDE_GFX_VERSION
|
|
|
|
#######################################################################
|
|
FROM rocm-prelim-hsa-override$HSA_OVERRIDE as rocm-deps
|
|
|
|
# Request yolov8 download at startup
|
|
ENV DOWNLOAD_YOLOV8=1
|
|
|