Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ultralytics 8.1.28 avoid * ops on bool Tensors for RT-DETR OpenVINO export #8937

Merged
merged 14 commits into from
Mar 15, 2024
2 changes: 1 addition & 1 deletion ultralytics/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ultralytics/models/rtdetr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
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

Expand Down
2 changes: 1 addition & 1 deletion ultralytics/nn/modules/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def _generate_anchors(self, shapes, grid_size=0.05, dtype=torch.float32, device=
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
Expand Down