PyCharm Code Inspect fixes (#18392)

Signed-off-by: UltralyticsAssistant <web@ultralytics.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-12-25 16:24:29 +01:00 committed by GitHub
parent d35860d4a1
commit e5e91967d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 72 additions and 72 deletions

View file

@ -441,7 +441,8 @@ class BaseMixTransform:
"""
raise NotImplementedError
def _update_label_text(self, labels):
@staticmethod
def _update_label_text(labels):
"""
Updates label text and class IDs for mixed labels in image augmentation.
@ -1259,7 +1260,8 @@ class RandomPerspective:
labels["resized_shape"] = img.shape[:2]
return labels
def box_candidates(self, box1, box2, wh_thr=2, ar_thr=100, area_thr=0.1, eps=1e-16):
@staticmethod
def box_candidates(box1, box2, wh_thr=2, ar_thr=100, area_thr=0.1, eps=1e-16):
"""
Compute candidate boxes for further processing based on size and aspect ratio criteria.
@ -1598,7 +1600,8 @@ class LetterBox:
else:
return img
def _update_labels(self, labels, ratio, padw, padh):
@staticmethod
def _update_labels(labels, ratio, padw, padh):
"""
Updates labels after applying letterboxing to an image.

View file

@ -68,7 +68,7 @@ class YOLODataset(BaseDataset):
Cache dataset labels, check images and read shapes.
Args:
path (Path): Path where to save the cache file. Default is Path('./labels.cache').
path (Path): Path where to save the cache file. Default is Path("./labels.cache").
Returns:
(dict): labels.
@ -219,7 +219,7 @@ class YOLODataset(BaseDataset):
segment_resamples = 100 if self.use_obb else 1000
if len(segments) > 0:
# make sure segments interpolate correctly if original length is greater than segment_resamples
max_len = max([len(s) for s in segments])
max_len = max(len(s) for s in segments)
segment_resamples = (max_len + 1) if segment_resamples < max_len else segment_resamples
# list[np.array(segment_resamples, 2)] * num_samples
segments = np.stack(resample_segments(segments, n=segment_resamples), axis=0)

View file

@ -11,8 +11,8 @@
python - <<EOF
from ultralytics.utils.downloads import attempt_download_asset
assets = [f'yolov8{size}{suffix}.pt' for size in 'nsmlx' for suffix in ('', '-cls', '-seg', '-pose')]
assets = [f"yolov8{size}{suffix}.pt" for size in "nsmlx" for suffix in ("", "-cls", "-seg", "-pose")]
for x in assets:
attempt_download_asset(f'weights/{x}')
attempt_download_asset(f"weights/{x}")
EOF