From 46ed520886179ff7fabd62a90d6e847c11379484 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 8 Nov 2024 06:37:18 -0700 Subject: [PATCH] Don't generate tensorrt models by default (#14865) --- docker-compose.yml | 2 +- docker/tensorrt/Dockerfile.base | 2 +- .../rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run | 5 +++++ docs/docs/configuration/object_detectors.md | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a4d349194..f36880593 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: # count: 1 # capabilities: [gpu] environment: - YOLO_MODELS: yolov7-320 + YOLO_MODELS: "" devices: - /dev/bus/usb:/dev/bus/usb # - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware diff --git a/docker/tensorrt/Dockerfile.base b/docker/tensorrt/Dockerfile.base index 59ead46f5..8720b5c60 100644 --- a/docker/tensorrt/Dockerfile.base +++ b/docker/tensorrt/Dockerfile.base @@ -25,7 +25,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos COPY docker/tensorrt/detector/rootfs/ / -ENV YOLO_MODELS="yolov7-320" +ENV YOLO_MODELS="" HEALTHCHECK --start-period=600s --start-interval=5s --interval=15s --timeout=5s --retries=3 \ CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1 diff --git a/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run b/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run index c39c7a0aa..4d734e05a 100755 --- a/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run +++ b/docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run @@ -19,6 +19,11 @@ FIRST_MODEL=true MODEL_DOWNLOAD="" MODEL_CONVERT="" +if [ -z "$YOLO_MODELS"]; then + echo "tensorrt model preparation disabled" + exit 0 +fi + for model in ${YOLO_MODELS//,/ } do # Remove old link in case path/version changed diff --git a/docs/docs/configuration/object_detectors.md b/docs/docs/configuration/object_detectors.md index 7fefa74a4..24888ae42 100644 --- a/docs/docs/configuration/object_detectors.md +++ b/docs/docs/configuration/object_detectors.md @@ -223,7 +223,7 @@ The model used for TensorRT must be preprocessed on the same hardware platform t The Frigate image will generate model files during startup if the specified model is not found. Processed models are stored in the `/config/model_cache` folder. Typically the `/config` path is mapped to a directory on the host already and the `model_cache` does not need to be mapped separately unless the user wants to store it in a different location on the host. -By default, the `yolov7-320` model will be generated, but this can be overridden by specifying the `YOLO_MODELS` environment variable in Docker. One or more models may be listed in a comma-separated format, and each one will be generated. To select no model generation, set the variable to an empty string, `YOLO_MODELS=""`. Models will only be generated if the corresponding `{model}.trt` file is not present in the `model_cache` folder, so you can force a model to be regenerated by deleting it from your Frigate data folder. +By default, no models will be generated, but this can be overridden by specifying the `YOLO_MODELS` environment variable in Docker. One or more models may be listed in a comma-separated format, and each one will be generated. Models will only be generated if the corresponding `{model}.trt` file is not present in the `model_cache` folder, so you can force a model to be regenerated by deleting it from your Frigate data folder. If you have a Jetson device with DLAs (Xavier or Orin), you can generate a model that will run on the DLA by appending `-dla` to your model name, e.g. specify `YOLO_MODELS=yolov7-320-dla`. The model will run on DLA0 (Frigate does not currently support DLA1). DLA-incompatible layers will fall back to running on the GPU. @@ -264,7 +264,7 @@ An example `docker-compose.yml` fragment that converts the `yolov4-608` and `yol ```yml frigate: environment: - - YOLO_MODELS=yolov4-608,yolov7x-640 + - YOLO_MODELS=yolov7-320,yolov7x-640 - USE_FP16=false ```