Skip to content

Commit 583867a

Browse files
Update ultralytics requirement from >=8.4.65 to >=8.4.83 (#2437)
* Update ultralytics requirement from >=8.4.65 to >=8.4.83 Updates the requirements on [ultralytics](https://github.com/ultralytics/ultralytics) to permit the latest version. - [Release notes](https://github.com/ultralytics/ultralytics/releases) - [Commits](ultralytics/ultralytics@v8.4.65...v8.4.83) --- updated-dependencies: - dependency-name: ultralytics dependency-version: 8.4.83 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Auto-format by https://ultralytics.com/actions --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
1 parent ae30bab commit 583867a

10 files changed

Lines changed: 18 additions & 34 deletions

File tree

models/common.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ def __init__(self, c1, c2, shortcut=True, g=1, e=0.5): # ch_in, ch_out, shortcu
160160
self.add = shortcut and c1 == c2
161161

162162
def forward(self, x):
163-
"""Executes forward pass, performing convolutional ops and optional shortcut addition; expects input tensor x.
164-
"""
163+
"""Executes forward pass, performing convolutional ops and optional shortcut addition; expects input tensor x."""
165164
return x + self.cv2(self.cv1(x)) if self.add else self.cv2(self.cv1(x))
166165

167166

@@ -183,8 +182,7 @@ def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5): # ch_in, ch_out, nu
183182
self.m = nn.Sequential(*(Bottleneck(c_, c_, shortcut, g, e=1.0) for _ in range(n)))
184183

185184
def forward(self, x):
186-
"""Processes input through layers, combining outputs with activation and normalization for feature extraction.
187-
"""
185+
"""Processes input through layers, combining outputs with activation and normalization for feature extraction."""
188186
y1 = self.cv3(self.m(self.cv1(x)))
189187
y2 = self.cv2(x)
190188
return self.cv4(self.act(self.bn(torch.cat((y1, y2), 1))))
@@ -212,8 +210,7 @@ class C3(nn.Module):
212210
"""Implements a CSP Bottleneck with 3 convolutions, optional shortcuts, group convolutions, and expansion factor."""
213211

214212
def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5): # ch_in, ch_out, number, shortcut, groups, expansion
215-
"""Initializes CSP Bottleneck with 3 convolutions, optional shortcuts, group convolutions, and expansion factor.
216-
"""
213+
"""Initializes CSP Bottleneck with 3 convolutions, optional shortcuts, group convolutions, and expansion factor."""
217214
super().__init__()
218215
c_ = int(c2 * e) # hidden channels
219216
self.cv1 = Conv(c1, c_, 1, 1)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ dependencies = [
7979
"pandas>=1.1.4",
8080
"packaging>=20.0", # general utilities
8181
"seaborn>=0.11.0", # plotting
82-
"ultralytics>=8.4.65",
82+
"ultralytics>=8.4.83",
8383
]
8484

8585
# Optional dependencies ------------------------------------------------------------------------------------------------

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ thop>=0.1.1 # Model profiling - FLOPs and parameter count
1717
torch>=1.8.0 # Core PyTorch for training/inference
1818
torchvision>=0.9.0 # Torch utilities for vision (transforms, datasets)
1919
tqdm>=4.66.3 # Progress bar in CLI
20-
ultralytics>=8.4.65 # YOLO framework library (models, training, utils)
20+
ultralytics>=8.4.83 # YOLO framework library (models, training, utils)
2121

2222
# Logging ---------------------------------------------------------------------
2323
# tensorboard>=2.4.1 # Visual logging (scalars, images)

utils/activations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def __init__(self, c1, k=1, s=1, r=16): # ch_in, kernel, stride, r
110110
# self.bn2 = nn.BatchNorm2d(c1)
111111

112112
def forward(self, x):
113-
"""Apply the MetaAconC activation, generating beta from the input's spatial average via the bottleneck network.
114-
"""
113+
"""Apply the MetaAconC activation, generating beta from the input's spatial average via the bottleneck network."""
115114
y = x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True)
116115
# batch-size 1 bug/instabilities https://github.com/ultralytics/yolov5/issues/2891
117116
# beta = torch.sigmoid(self.bn2(self.fc2(self.bn1(self.fc1(y))))) # bug/unstable

utils/augmentations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ def cutout(im, labels, p=0.5):
263263

264264

265265
def mixup(im, labels, im2, labels2):
266-
"""Applies MixUp augmentation by blending images and labels; see https://arxiv.org/pdf/1710.09412.pdf for details.
267-
"""
266+
"""Applies MixUp augmentation by blending images and labels; see https://arxiv.org/pdf/1710.09412.pdf for details."""
268267
r = np.random.beta(32.0, 32.0) # mixup ratio, alpha=beta=32.0
269268
im = (im * r + im2 * (1 - r)).astype(np.uint8)
270269
labels = np.concatenate((labels, labels2), 0)

utils/dataloaders.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,7 @@ def __len__(self):
481481

482482

483483
def img2label_paths(img_paths):
484-
"""Converts image paths to corresponding label paths by replacing `/images/` with `/labels/` and `.jpg` with `.txt`.
485-
"""
484+
"""Converts image paths to corresponding label paths by replacing `/images/` with `/labels/` and `.jpg` with `.txt`."""
486485
sa, sb = f"{os.sep}images{os.sep}", f"{os.sep}labels{os.sep}" # /images/, /labels/ substrings
487486
return [sb.join(x.rsplit(sa, 1)).rsplit(".", 1)[0] + ".txt" for x in img_paths]
488487

utils/general.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ class Profile(contextlib.ContextDecorator):
197197
"""Profiles code execution time, usable as a context manager or decorator for performance monitoring."""
198198

199199
def __init__(self, t=0.0):
200-
"""Initializes a profiling context for YOLOv3 with optional timing threshold `t` and checks CUDA availability.
201-
"""
200+
"""Initializes a profiling context for YOLOv3 with optional timing threshold `t` and checks CUDA availability."""
202201
self.t = t
203202
self.cuda = torch.cuda.is_available()
204203

@@ -225,8 +224,7 @@ class Timeout(contextlib.ContextDecorator):
225224
"""Enforces a timeout on code execution, raising TimeoutError on expiry."""
226225

227226
def __init__(self, seconds, *, timeout_msg="", suppress_timeout_errors=True):
228-
"""Initializes a timeout context/decorator with specified duration, custom message, and error handling option.
229-
"""
227+
"""Initializes a timeout context/decorator with specified duration, custom message, and error handling option."""
230228
self.seconds = int(seconds)
231229
self.timeout_message = timeout_msg
232230
self.suppress = bool(suppress_timeout_errors)
@@ -311,15 +309,13 @@ def get_default_args(func):
311309

312310

313311
def get_latest_run(search_dir="."):
314-
"""Returns path to the most recent 'last.pt' file within 'search_dir' for resuming, or an empty string if not found.
315-
"""
312+
"""Returns path to the most recent 'last.pt' file within 'search_dir' for resuming, or an empty string if not found."""
316313
last_list = glob.glob(f"{search_dir}/**/last*.pt", recursive=True)
317314
return max(last_list, key=os.path.getctime) if last_list else ""
318315

319316

320317
def check_online():
321-
"""Checks internet connectivity by attempting to connect to "1.1.1.1" on port 443 twice; returns True if successful.
322-
"""
318+
"""Checks internet connectivity by attempting to connect to "1.1.1.1" on port 443 twice; returns True if successful."""
323319
import socket
324320

325321
def run_once():
@@ -614,12 +610,10 @@ def url2file(url):
614610

615611

616612
def download(url, dir=".", unzip=True, delete=True, curl=False, threads=1, retry=3):
617-
"""Downloads files from URLs into a specified directory, optionally unzips, and supports multithreading and retries.
618-
"""
613+
"""Downloads files from URLs into a specified directory, optionally unzips, and supports multithreading and retries."""
619614

620615
def download_one(url, dir):
621-
"""Downloads a file from a URL into the specified directory, supporting retries and using curl or torch methods.
622-
"""
616+
"""Downloads a file from a URL into the specified directory, supporting retries and using curl or torch methods."""
623617
success = True
624618
if os.path.isfile(url):
625619
f = Path(url) # filename

utils/loss.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def __init__(self, loss_fcn, gamma=1.5, alpha=0.25):
8383
self.loss_fcn.reduction = "none" # required to apply FL to each element
8484

8585
def forward(self, pred, true):
86-
"""Computes focal loss between predictions and true labels using configured loss function, `gamma`, and `alpha`.
87-
"""
86+
"""Computes focal loss between predictions and true labels using configured loss function, `gamma`, and `alpha`."""
8887
loss = self.loss_fcn(pred, true)
8988

9089
pred_prob = torch.sigmoid(pred) # prob from logits
@@ -187,8 +186,7 @@ def __call__(self, p, targets): # predictions, targets
187186
return (lbox + lobj + lcls) * bs, torch.cat((lbox, lobj, lcls)).detach()
188187

189188
def build_targets(self, p, targets):
190-
"""Match `targets` (image, class, x, y, w, h) to anchors per layer, returning tcls, tbox, indices, and anchors.
191-
"""
189+
"""Match `targets` (image, class, x, y, w, h) to anchors per layer, returning tcls, tbox, indices, and anchors."""
192190
na, nt = self.na, targets.shape[0] # number of anchors, targets
193191
tcls, tbox, indices, anch = [], [], [], []
194192
gain = torch.ones(7, device=self.device) # normalized to gridspace gain

utils/torch_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ def de_parallel(model):
184184

185185

186186
def sparsity(model):
187-
"""Calculates and returns the global sparsity of a model as the ratio of zero-valued parameters to total parameters.
188-
"""
187+
"""Calculates and returns the global sparsity of a model as the ratio of zero-valued parameters to total parameters."""
189188
a, b = 0, 0
190189
for p in model.parameters():
191190
a += p.numel()

utils/triton.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ def __call__(self, *args, **kwargs) -> torch.Tensor | tuple[torch.Tensor, ...]:
7171
return result[0] if len(result) == 1 else result
7272

7373
def _create_inputs(self, *args, **kwargs):
74-
"""Generates model inputs from args or kwargs, not allowing both; raises error if neither or both are provided.
75-
"""
74+
"""Generates model inputs from args or kwargs, not allowing both; raises error if neither or both are provided."""
7675
args_len, kwargs_len = len(args), len(kwargs)
7776
if not args_len and not kwargs_len:
7877
raise RuntimeError("No inputs provided.")

0 commit comments

Comments
 (0)