diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 170bdaa4ff..e944e85b3f 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -109,10 +109,18 @@ jobs: - name: Build Image if: github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true' - run: | - docker build --platform ${{ matrix.platforms }} -f docker/${{ matrix.dockerfile }} \ - -t ultralytics/ultralytics:${{ matrix.tags }} \ - -t ultralytics/ultralytics:${{ steps.get_version.outputs.version_tag }} . + uses: nick-invision/retry@v2 + with: + timeout_minutes: 60 + retry_wait_seconds: 0 + max_attempts: 1 + command: | + docker build \ + --platform ${{ matrix.platforms }} \ + -f docker/${{ matrix.dockerfile }} \ + -t ultralytics/ultralytics:${{ matrix.tags }} \ + -t ultralytics/ultralytics:${{ steps.get_version.outputs.version_tag }} \ + . - name: Run Tests if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && matrix.platforms == 'linux/amd64' && matrix.dockerfile != 'Dockerfile-conda' # arm64 images not supported on GitHub CI runners diff --git a/docker/Dockerfile b/docker/Dockerfile index 867ec6be93..c8ab707e23 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,9 @@ FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime RUN pip install --no-cache nvidia-tensorrt --index-url https://pypi.ngc.nvidia.com # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package diff --git a/docker/Dockerfile-arm64 b/docker/Dockerfile-arm64 index 5f029274e6..b789662c58 100644 --- a/docker/Dockerfile-arm64 +++ b/docker/Dockerfile-arm64 @@ -6,7 +6,9 @@ FROM arm64v8/ubuntu:22.04 # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package diff --git a/docker/Dockerfile-conda b/docker/Dockerfile-conda index fe3aed5f2d..30d4ce1c65 100644 --- a/docker/Dockerfile-conda +++ b/docker/Dockerfile-conda @@ -6,7 +6,9 @@ FROM continuumio/miniconda3:latest # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages RUN apt update \ diff --git a/docker/Dockerfile-cpu b/docker/Dockerfile-cpu index 15b741102a..ea888e8e60 100644 --- a/docker/Dockerfile-cpu +++ b/docker/Dockerfile-cpu @@ -6,7 +6,9 @@ FROM ubuntu:23.10 # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package diff --git a/docker/Dockerfile-jetson b/docker/Dockerfile-jetson index 61cc2ad9dd..6528628ad1 100644 --- a/docker/Dockerfile-jetson +++ b/docker/Dockerfile-jetson @@ -6,7 +6,9 @@ FROM nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3 # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package diff --git a/docker/Dockerfile-python b/docker/Dockerfile-python index b2a8a16293..03f256b552 100644 --- a/docker/Dockerfile-python +++ b/docker/Dockerfile-python @@ -6,7 +6,9 @@ FROM python:3.10-slim-bookworm # Downloads to user config dir -ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ +ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ + https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ + /root/.config/Ultralytics/ # Install linux packages # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 543cd0345e..cf9442a3e9 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.1.8" +__version__ = "8.1.9" from ultralytics.data.explorer.explorer import Explorer from ultralytics.models import RTDETR, SAM, YOLO diff --git a/ultralytics/engine/trainer.py b/ultralytics/engine/trainer.py index 71ea5e84e1..770bad1b44 100644 --- a/ultralytics/engine/trainer.py +++ b/ultralytics/engine/trainer.py @@ -400,7 +400,7 @@ class BaseTrainer: # Log mem = f"{torch.cuda.memory_reserved() / 1E9 if torch.cuda.is_available() else 0:.3g}G" # (GB) - loss_len = self.tloss.shape[0] if len(self.tloss.size()) else 1 + loss_len = self.tloss.shape[0] if len(self.tloss.shape) else 1 losses = self.tloss if loss_len > 1 else torch.unsqueeze(self.tloss, 0) if RANK in (-1, 0): pbar.set_description( diff --git a/ultralytics/models/sam/modules/decoders.py b/ultralytics/models/sam/modules/decoders.py index 41e3af5d5a..073b1ad40c 100644 --- a/ultralytics/models/sam/modules/decoders.py +++ b/ultralytics/models/sam/modules/decoders.py @@ -121,7 +121,7 @@ class MaskDecoder(nn.Module): """ # Concatenate output tokens output_tokens = torch.cat([self.iou_token.weight, self.mask_tokens.weight], dim=0) - output_tokens = output_tokens.unsqueeze(0).expand(sparse_prompt_embeddings.size(0), -1, -1) + output_tokens = output_tokens.unsqueeze(0).expand(sparse_prompt_embeddings.shape[0], -1, -1) tokens = torch.cat((output_tokens, sparse_prompt_embeddings), dim=1) # Expand per-image data in batch direction to be per-mask diff --git a/ultralytics/models/sam/modules/tiny_encoder.py b/ultralytics/models/sam/modules/tiny_encoder.py index ac37868034..98f5ac04a4 100644 --- a/ultralytics/models/sam/modules/tiny_encoder.py +++ b/ultralytics/models/sam/modules/tiny_encoder.py @@ -732,7 +732,7 @@ class TinyViT(nn.Module): for i in range(start_i, len(self.layers)): layer = self.layers[i] x = layer(x) - B, _, C = x.size() + B, _, C = x.shape x = x.view(B, 64, 64, C) x = x.permute(0, 3, 1, 2) return self.neck(x) diff --git a/ultralytics/trackers/utils/gmc.py b/ultralytics/trackers/utils/gmc.py index ddcc521350..312e034930 100644 --- a/ultralytics/trackers/utils/gmc.py +++ b/ultralytics/trackers/utils/gmc.py @@ -258,7 +258,7 @@ class GMC: # import matplotlib.pyplot as plt # matches_img = np.hstack((self.prevFrame, frame)) # matches_img = cv2.cvtColor(matches_img, cv2.COLOR_GRAY2BGR) - # W = np.size(self.prevFrame, 1) + # W = self.prevFrame.shape[1] # for m in goodMatches: # prev_pt = np.array(self.prevKeyPoints[m.queryIdx].pt, dtype=np.int_) # curr_pt = np.array(keypoints[m.trainIdx].pt, dtype=np.int_) @@ -275,7 +275,7 @@ class GMC: # plt.show() # Find rigid matrix - if (np.size(prevPoints, 0) > 4) and (np.size(prevPoints, 0) == np.size(prevPoints, 0)): + if (prevPoints.shape[0] > 4) and (prevPoints.shape[0] == prevPoints.shape[0]): H, inliers = cv2.estimateAffinePartial2D(prevPoints, currPoints, cv2.RANSAC) # Handle downscale @@ -343,7 +343,7 @@ class GMC: currPoints = np.array(currPoints) # Find rigid matrix - if np.size(prevPoints, 0) > 4 and np.size(prevPoints, 0) == np.size(prevPoints, 0): + if (prevPoints.shape[0] > 4) and (prevPoints.shape[0] == prevPoints.shape[0]): H, inliers = cv2.estimateAffinePartial2D(prevPoints, currPoints, cv2.RANSAC) if self.downscale > 1.0: diff --git a/ultralytics/utils/metrics.py b/ultralytics/utils/metrics.py index 24a18a16ba..32a14c54e8 100644 --- a/ultralytics/utils/metrics.py +++ b/ultralytics/utils/metrics.py @@ -331,7 +331,7 @@ class ConfusionMatrix: gt_bboxes (Array[M, 4]): Ground truth bounding boxes with xyxy format. gt_cls (Array[M]): The class labels. """ - if gt_cls.size(0) == 0: # Check if labels is empty + if gt_cls.shape[0] == 0: # Check if labels is empty if detections is not None: detections = detections[detections[:, 4] > self.conf] detection_classes = detections[:, 5].int() diff --git a/ultralytics/utils/tal.py b/ultralytics/utils/tal.py index 42bcf72da4..80fee091de 100644 --- a/ultralytics/utils/tal.py +++ b/ultralytics/utils/tal.py @@ -56,8 +56,8 @@ class TaskAlignedAssigner(nn.Module): fg_mask (Tensor): shape(bs, num_total_anchors) target_gt_idx (Tensor): shape(bs, num_total_anchors) """ - self.bs = pd_scores.size(0) - self.n_max_boxes = gt_bboxes.size(1) + self.bs = pd_scores.shape[0] + self.n_max_boxes = gt_bboxes.shape[1] if self.n_max_boxes == 0: device = gt_bboxes.device diff --git a/ultralytics/utils/torch_utils.py b/ultralytics/utils/torch_utils.py index bdd7e33555..c286576aab 100644 --- a/ultralytics/utils/torch_utils.py +++ b/ultralytics/utils/torch_utils.py @@ -190,7 +190,7 @@ def fuse_conv_and_bn(conv, bn): fusedconv.weight.copy_(torch.mm(w_bn, w_conv).view(fusedconv.weight.shape)) # Prepare spatial bias - b_conv = torch.zeros(conv.weight.size(0), device=conv.weight.device) if conv.bias is None else conv.bias + b_conv = torch.zeros(conv.weight.shape[0], device=conv.weight.device) if conv.bias is None else conv.bias b_bn = bn.bias - bn.weight.mul(bn.running_mean).div(torch.sqrt(bn.running_var + bn.eps)) fusedconv.bias.copy_(torch.mm(w_bn, b_conv.reshape(-1, 1)).reshape(-1) + b_bn) @@ -221,7 +221,7 @@ def fuse_deconv_and_bn(deconv, bn): fuseddconv.weight.copy_(torch.mm(w_bn, w_deconv).view(fuseddconv.weight.shape)) # Prepare spatial bias - b_conv = torch.zeros(deconv.weight.size(1), device=deconv.weight.device) if deconv.bias is None else deconv.bias + b_conv = torch.zeros(deconv.weight.shape[1], device=deconv.weight.device) if deconv.bias is None else deconv.bias b_bn = bn.bias - bn.weight.mul(bn.running_mean).div(torch.sqrt(bn.running_var + bn.eps)) fuseddconv.bias.copy_(torch.mm(w_bn, b_conv.reshape(-1, 1)).reshape(-1) + b_bn)