Apply ruff==0.9.0 formatting (#18624)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-01-10 17:27:22 +01:00 committed by GitHub
parent c196a82bfa
commit 34b339d033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 17 additions and 30 deletions

View file

@ -60,8 +60,7 @@ def exif_size(img: Image.Image):
s = img.size # (width, height)
if img.format == "JPEG": # only support JPEG images
try:
exif = img.getexif()
if exif:
if exif := img.getexif():
rotation = exif.get(274, None) # the EXIF key for the orientation tag is 274
if rotation in {6, 8}: # rotation 270 or 90
s = s[1], s[0]
@ -125,8 +124,7 @@ def verify_image_label(args):
segments = [np.array(x[1:], dtype=np.float32).reshape(-1, 2) for x in lb] # (cls, xy1...)
lb = np.concatenate((classes.reshape(-1, 1), segments2boxes(segments)), 1) # (cls, xywh)
lb = np.array(lb, dtype=np.float32)
nl = len(lb)
if nl:
if nl := len(lb):
if keypoint:
assert lb.shape[1] == (5 + nkpt * ndim), f"labels require {(5 + nkpt * ndim)} columns each"
points = lb[:, 5:].reshape(-1, ndim)[:, :2]