mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
ultralytics 8.1.28
avoid * ops on bool Tensors for RT-DETR OpenVINO export (#8937)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
bc34ae560b
commit
2d513a9e4b
@ -1,6 +1,6 @@
|
|||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.1.27"
|
__version__ = "8.1.28"
|
||||||
|
|
||||||
from ultralytics.data.explorer.explorer import Explorer
|
from ultralytics.data.explorer.explorer import Explorer
|
||||||
from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld
|
from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld
|
||||||
|
@ -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
|
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.engine.model import Model
|
||||||
from ultralytics.nn.tasks import RTDETRDetectionModel
|
from ultralytics.nn.tasks import RTDETRDetectionModel
|
||||||
|
|
||||||
|
@ -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.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)
|
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 = torch.log(anchors / (1 - anchors))
|
||||||
anchors = anchors.masked_fill(~valid_mask, float("inf"))
|
anchors = anchors.masked_fill(~valid_mask, float("inf"))
|
||||||
return anchors, valid_mask
|
return anchors, valid_mask
|
||||||
|
Loading…
x
Reference in New Issue
Block a user