From 3bb0c5afa3e8af373beae00be2ad8e91ed663b5b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 24 Jun 2024 21:05:09 +0200 Subject: [PATCH] `ultralytics 8.2.42` NVIDIA TensorRT 10 default (#13943) Signed-off-by: Glenn Jocher Co-authored-by: DeepDiver Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> --- docker/Dockerfile | 4 ++-- docker/Dockerfile-arm64 | 4 ++-- docker/Dockerfile-conda | 4 ++-- docker/Dockerfile-cpu | 4 ++-- docker/Dockerfile-jetson-jetpack5 | 2 +- docker/Dockerfile-python | 4 ++-- docker/Dockerfile-runner | 5 +++-- ultralytics/__init__.py | 2 +- ultralytics/engine/exporter.py | 8 ++++---- ultralytics/utils/loss.py | 8 ++++---- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 3e337166..88f346d8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,7 +20,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package # libsm6 required by libqxcb to create QT-based windows for visualization; set 'QT_DEBUG_PLUGINS=1' to test in docker RUN apt update \ - && apt install --no-install-recommends -y gcc git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 libsm6 + && apt install --no-install-recommends -y gcc git zip unzip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 libsm6 # Security updates # https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796 @@ -62,7 +62,7 @@ RUN rm -rf tmp # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus '"device=2,3"' $t # Pull and Run with local directory access -# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/datasets:/usr/src/datasets $t +# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/shared/datasets:/usr/src/datasets $t # Kill all # sudo docker kill $(sudo docker ps -q) diff --git a/docker/Dockerfile-arm64 b/docker/Dockerfile-arm64 index 5b89ac8c..db95fc95 100644 --- a/docker/Dockerfile-arm64 +++ b/docker/Dockerfile-arm64 @@ -18,7 +18,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package # pkg-config and libhdf5-dev (not included) are needed to build 'h5py==3.11.0' aarch64 wheel required by 'tensorflow' RUN apt update \ - && apt install --no-install-recommends -y python3-pip git zip curl htop gcc libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 + && apt install --no-install-recommends -y python3-pip git zip unzip curl htop gcc libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 # Create working directory WORKDIR $APP_HOME @@ -52,4 +52,4 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python # t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host $t # Pull and Run with local volume mounted -# t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t +# t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/usr/src/datasets $t diff --git a/docker/Dockerfile-conda b/docker/Dockerfile-conda index 0ab647bb..1f8fe675 100644 --- a/docker/Dockerfile-conda +++ b/docker/Dockerfile-conda @@ -22,7 +22,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt . RUN conda config --set solver libmamba && \ conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia && \ conda install -c conda-forge ultralytics mkl - # conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics mkl + # conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=12.1 ultralytics mkl # Usage Examples ------------------------------------------------------------------------------------------------------- @@ -37,4 +37,4 @@ RUN conda config --set solver libmamba && \ # t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host $t # Pull and Run with local volume mounted -# t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t +# t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/usr/src/datasets $t diff --git a/docker/Dockerfile-cpu b/docker/Dockerfile-cpu index fe266bc4..da7f09f9 100644 --- a/docker/Dockerfile-cpu +++ b/docker/Dockerfile-cpu @@ -16,7 +16,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package RUN apt update \ - && apt install --no-install-recommends -y python3-pip git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 + && apt install --no-install-recommends -y python3-pip git zip unzip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 # Create working directory WORKDIR $APP_HOME @@ -57,4 +57,4 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python # t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host --name NAME $t # Pull and Run with local volume mounted -# t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t +# t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/usr/src/datasets $t diff --git a/docker/Dockerfile-jetson-jetpack5 b/docker/Dockerfile-jetson-jetpack5 index 129e2f67..2737876c 100644 --- a/docker/Dockerfile-jetson-jetpack5 +++ b/docker/Dockerfile-jetson-jetpack5 @@ -18,7 +18,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ # libusb-1.0-0 required for 'tflite_support' package when exporting to TFLite # pkg-config and libhdf5-dev (not included) are needed to build 'h5py==3.11.0' aarch64 wheel required by 'tensorflow' RUN apt update \ - && apt install --no-install-recommends -y gcc git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 + && apt install --no-install-recommends -y gcc git zip unzip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 # Create working directory WORKDIR $APP_HOME diff --git a/docker/Dockerfile-python b/docker/Dockerfile-python index 27775720..b34a5302 100644 --- a/docker/Dockerfile-python +++ b/docker/Dockerfile-python @@ -16,7 +16,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package RUN apt update \ - && apt install --no-install-recommends -y python3-pip git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 + && apt install --no-install-recommends -y python3-pip git zip unzip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 # Create working directory WORKDIR $APP_HOME @@ -54,4 +54,4 @@ RUN rm -rf tmp # t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t # Pull and Run with local volume mounted -# t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/datasets:/usr/src/datasets $t +# t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/usr/src/datasets $t diff --git a/docker/Dockerfile-runner b/docker/Dockerfile-runner index c0f8659b..8c7bd40e 100644 --- a/docker/Dockerfile-runner +++ b/docker/Dockerfile-runner @@ -9,14 +9,15 @@ FROM ultralytics/ultralytics:latest WORKDIR /actions-runner # Download and unpack the latest runner from https://github.com/actions/runner -RUN FILENAME=actions-runner-linux-x64-2.309.0.tar.gz && \ - curl -o $FILENAME -L https://github.com/actions/runner/releases/download/v2.309.0/$FILENAME && \ +RUN FILENAME=actions-runner-linux-x64-2.317.0.tar.gz && \ + curl -o $FILENAME -L https://github.com/actions/runner/releases/download/v2.317.0/$FILENAME && \ tar xzf $FILENAME && \ rm $FILENAME # Install runner dependencies ENV RUNNER_ALLOW_RUNASROOT=1 ENV DEBIAN_FRONTEND=noninteractive +RUN pip install --no-cache-dir pytest-cov RUN ./bin/installdependencies.sh && \ apt-get -y install libicu-dev diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index a85ed8ee..cf9cf9e2 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.2.41" +__version__ = "8.2.42" import os diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index f47f67ce..d982965e 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -822,13 +822,13 @@ class Exporter: import tensorflow as tf # noqa check_requirements( ( - "keras", # required by onnx2tf package - "tf_keras", # required by onnx2tf package + "keras", # required by 'onnx2tf' package + "tf_keras", # required by 'onnx2tf' package + "sng4onnx>=1.0.1", # required by 'onnx2tf' package + "onnx_graphsurgeon>=0.3.26", # required by 'onnx2tf' package "onnx>=1.12.0", "onnx2tf>1.17.5,<=1.22.3", - "sng4onnx>=1.0.1", "onnxslim>=0.1.31", - "onnx_graphsurgeon>=0.3.26", "tflite_support<=0.4.3" if IS_JETSON else "tflite_support", # fix ImportError 'GLIBCXX_3.4.29' "flatbuffers>=23.5.26,<100", # update old 'flatbuffers' included inside tensorflow package "onnxruntime-gpu" if cuda else "onnxruntime", diff --git a/ultralytics/utils/loss.py b/ultralytics/utils/loss.py index 11c14949..f071e275 100644 --- a/ultralytics/utils/loss.py +++ b/ultralytics/utils/loss.py @@ -214,7 +214,7 @@ class v8DetectionLoss: targets = torch.cat((batch["batch_idx"].view(-1, 1), batch["cls"].view(-1, 1), batch["bboxes"]), 1) targets = self.preprocess(targets.to(self.device), batch_size, scale_tensor=imgsz[[1, 0, 1, 0]]) gt_labels, gt_bboxes = targets.split((1, 4), 2) # cls, xyxy - mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0) + mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0.0) # Pboxes pred_bboxes = self.bbox_decode(anchor_points, pred_distri) # xyxy, (b, h*w, 4) @@ -280,7 +280,7 @@ class v8SegmentationLoss(v8DetectionLoss): targets = torch.cat((batch_idx, batch["cls"].view(-1, 1), batch["bboxes"]), 1) targets = self.preprocess(targets.to(self.device), batch_size, scale_tensor=imgsz[[1, 0, 1, 0]]) gt_labels, gt_bboxes = targets.split((1, 4), 2) # cls, xyxy - mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0) + mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0.0) except RuntimeError as e: raise TypeError( "ERROR ❌ segment dataset incorrectly formatted or not a segment dataset.\n" @@ -467,7 +467,7 @@ class v8PoseLoss(v8DetectionLoss): targets = torch.cat((batch_idx, batch["cls"].view(-1, 1), batch["bboxes"]), 1) targets = self.preprocess(targets.to(self.device), batch_size, scale_tensor=imgsz[[1, 0, 1, 0]]) gt_labels, gt_bboxes = targets.split((1, 4), 2) # cls, xyxy - mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0) + mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0.0) # Pboxes pred_bboxes = self.bbox_decode(anchor_points, pred_distri) # xyxy, (b, h*w, 4) @@ -652,7 +652,7 @@ class v8OBBLoss(v8DetectionLoss): targets = targets[(rw >= 2) & (rh >= 2)] # filter rboxes of tiny size to stabilize training targets = self.preprocess(targets.to(self.device), batch_size, scale_tensor=imgsz[[1, 0, 1, 0]]) gt_labels, gt_bboxes = targets.split((1, 5), 2) # cls, xywhr - mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0) + mask_gt = gt_bboxes.sum(2, keepdim=True).gt_(0.0) except RuntimeError as e: raise TypeError( "ERROR ❌ OBB dataset incorrectly formatted or not a OBB dataset.\n"