ultralytics 8.3.61 Restore Python 3.8 compatibility (#18666)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-01-13 21:13:27 +01:00 committed by GitHub
parent ffd8df3751
commit 4922016901
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 11 deletions

View file

@ -39,8 +39,7 @@ on:
jobs:
HUB:
# if: github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.hub == 'true'))
if: github.repository == 'ultralytics/ultralytics' && 'workflow_dispatch' && github.event.inputs.hub == 'true'
if: github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.hub == 'true'))
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -165,7 +164,7 @@ jobs:
torch: [latest]
include:
- os: ubuntu-latest
python-version: "3.9" # torch 1.8.0 requires python >=3.6, <=3.9
python-version: "3.8" # torch 1.8.0 requires python >=3.6, <=3.9
torch: "1.8.0" # min torch version CI https://pypi.org/project/torchvision/
steps:
- uses: actions/checkout@v4

View file

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.3.60"
__version__ = "8.3.61"
import os

View file

@ -106,7 +106,7 @@ class SAM(Model):
... print(f"Detected {len(r.masks)} masks")
"""
overrides = dict(conf=0.25, task="segment", mode="predict", imgsz=1024)
kwargs = overrides | kwargs
kwargs = {**overrides, **kwargs}
prompts = dict(bboxes=bboxes, points=points, labels=labels)
return super().predict(source, stream, prompts=prompts, **kwargs)

View file

@ -54,7 +54,7 @@ def select_closest_cond_frames(frame_idx, cond_frame_outputs, max_cond_frame_num
(t for t in cond_frame_outputs if t not in selected_outputs),
key=lambda x: abs(x - frame_idx),
)[:num_remain]
selected_outputs |= ((t, cond_frame_outputs[t]) for t in inds_remain)
selected_outputs.update((t, cond_frame_outputs[t]) for t in inds_remain)
unselected_outputs = {t: v for t, v in cond_frame_outputs.items() if t not in selected_outputs}
return selected_outputs, unselected_outputs

View file

@ -243,9 +243,10 @@ class DETRLoss(nn.Module):
if len(gt_bboxes):
gt_scores[idx] = bbox_iou(pred_bboxes.detach(), gt_bboxes, xywh=True).squeeze(-1)
loss = {}
loss |= self._get_loss_class(pred_scores, targets, gt_scores, len(gt_bboxes), postfix)
loss.update(self._get_loss_bbox(pred_bboxes, gt_bboxes, postfix))
loss = {
**self._get_loss_class(pred_scores, targets, gt_scores, len(gt_bboxes), postfix),
**self._get_loss_bbox(pred_bboxes, gt_bboxes, postfix),
}
# if masks is not None and gt_mask is not None:
# loss.update(self._get_loss_mask(masks, gt_mask, match_indices, postfix))
return loss

View file

@ -62,7 +62,7 @@ class Inference:
self.selected_ind = [] # List of selected classes for detection or tracking
self.model = None # Container for the loaded model instance
self.temp_dict = {"model": None} | kwargs
self.temp_dict = {"model": None, **kwargs}
self.model_path = None # Store model file name with path
if self.temp_dict["model"] is not None:
self.model_path = self.temp_dict["model"]

View file

@ -1243,7 +1243,7 @@ class SettingsManager(JSONDict):
"""Updates settings, validating keys and types."""
for arg in args:
if isinstance(arg, dict):
kwargs |= arg
kwargs.update(arg)
for k, v in kwargs.items():
if k not in self.defaults:
raise KeyError(f"No Ultralytics setting '{k}'. {self.help_msg}")