From 2d513a9e4bf51e961a4199067383d2052f483874 Mon Sep 17 00:00:00 2001 From: Kayzwer <68285002+Kayzwer@users.noreply.github.com> Date: Fri, 15 Mar 2024 08:20:10 +0800 Subject: [PATCH] `ultralytics 8.1.28` avoid * ops on bool Tensors for RT-DETR OpenVINO export (#8937) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher --- ultralytics/__init__.py | 2 +- ultralytics/models/rtdetr/model.py | 2 -- ultralytics/nn/modules/head.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 846f8c3f..e79ad3ed 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.1.27" +__version__ = "8.1.28" from ultralytics.data.explorer.explorer import Explorer from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld diff --git a/ultralytics/models/rtdetr/model.py b/ultralytics/models/rtdetr/model.py index 68d43be7..440df179 100644 --- a/ultralytics/models/rtdetr/model.py +++ b/ultralytics/models/rtdetr/model.py @@ -7,8 +7,6 @@ hybrid encoder and IoU-aware query selection for enhanced detection accuracy. For more information on RT-DETR, visit: https://arxiv.org/pdf/2304.08069.pdf """ -from pathlib import Path - from ultralytics.engine.model import Model from ultralytics.nn.tasks import RTDETRDetectionModel diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py index b8fa5fd0..9cd794e4 100644 --- a/ultralytics/nn/modules/head.py +++ b/ultralytics/nn/modules/head.py @@ -395,7 +395,7 @@ class RTDETRDecoder(nn.Module): anchors.append(torch.cat([grid_xy, wh], -1).view(-1, h * w, 4)) # (1, h*w, 4) anchors = torch.cat(anchors, 1) # (1, h*w*nl, 4) - valid_mask = ((anchors > eps) * (anchors < 1 - eps)).all(-1, keepdim=True) # 1, h*w*nl, 1 + valid_mask = ((anchors > eps) & (anchors < 1 - eps)).all(-1, keepdim=True) # 1, h*w*nl, 1 anchors = torch.log(anchors / (1 - anchors)) anchors = anchors.masked_fill(~valid_mask, float("inf")) return anchors, valid_mask