Standardize license headers in Python files (#13490)

* Refactor code for speed and clarity

* Auto-format by https://ultralytics.com/actions

---------

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
authored and GitHub committed 2025-01-15 15:31:19 +01:00
1 parent 6420a1db87
commit c568972d59
52 files changed
+67 -64

No files matched your search

+3 -4
View File
@@ -1,4 +1,4 @@
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Common modules."""
import ast
@@ -750,9 +750,8 @@ class DetectMultiBackend(nn.Module):
scale, zero_point = output["quantization"]
x = (x.astype(np.float32) - zero_point) * scale # re-scale
y.append(x)
if len(y) == 2: # segment with (det, proto) output order reversed
if len(y[1].shape) != 4:
y = list(reversed(y)) # should be y = (1, 116, 8400), (1, 160, 160, 32)
if len(y) == 2 and len(y[1].shape) != 4:
y = list(reversed(y))
y = [x if isinstance(x, np.ndarray) else x.numpy() for x in y]
y[0][..., :4] *= [w, h, w, h] # xywh normalized to pixels