PyCharm Code and Docs Inspect fixes v1 (#18461)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
126867e355
commit
7f1a50e893
26 changed files with 90 additions and 91 deletions
|
|
@ -642,7 +642,7 @@ class Mosaic(BaseMixTransform):
|
|||
c = s - w, s + h0 - h, s, s + h0
|
||||
|
||||
padw, padh = c[:2]
|
||||
x1, y1, x2, y2 = (max(x, 0) for x in c) # allocate coords
|
||||
x1, y1, x2, y2 = (max(x, 0) for x in c) # allocate coordinates
|
||||
|
||||
img3[y1:y2, x1:x2] = img[y1 - padh :, x1 - padw :] # img3[ymin:ymax, xmin:xmax]
|
||||
# hp, wp = h, w # height, width previous for next iteration
|
||||
|
|
@ -771,7 +771,7 @@ class Mosaic(BaseMixTransform):
|
|||
c = s - w, s + h0 - hp - h, s, s + h0 - hp
|
||||
|
||||
padw, padh = c[:2]
|
||||
x1, y1, x2, y2 = (max(x, 0) for x in c) # allocate coords
|
||||
x1, y1, x2, y2 = (max(x, 0) for x in c) # allocate coordinates
|
||||
|
||||
# Image
|
||||
img9[y1:y2, x1:x2] = img[y1 - padh :, x1 - padw :] # img9[ymin:ymax, xmin:xmax]
|
||||
|
|
@ -1283,7 +1283,7 @@ class RandomPerspective:
|
|||
eps (float): Small epsilon value to prevent division by zero.
|
||||
|
||||
Returns:
|
||||
(numpy.ndarray): Boolean array of shape (n,) indicating which boxes are candidates.
|
||||
(numpy.ndarray): Boolean array of shape (n) indicating which boxes are candidates.
|
||||
True values correspond to boxes that meet all criteria.
|
||||
|
||||
Examples:
|
||||
|
|
@ -1320,7 +1320,7 @@ class RandomHSV:
|
|||
>>> augmenter = RandomHSV(hgain=0.5, sgain=0.5, vgain=0.5)
|
||||
>>> image = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8)
|
||||
>>> labels = {"img": image}
|
||||
>>> augmented_labels = augmenter(labels)
|
||||
>>> augmenter(labels)
|
||||
>>> augmented_image = augmented_labels["img"]
|
||||
"""
|
||||
|
||||
|
|
@ -1337,7 +1337,7 @@ class RandomHSV:
|
|||
|
||||
Examples:
|
||||
>>> hsv_aug = RandomHSV(hgain=0.5, sgain=0.5, vgain=0.5)
|
||||
>>> augmented_image = hsv_aug(image)
|
||||
>>> hsv_aug(image)
|
||||
"""
|
||||
self.hgain = hgain
|
||||
self.sgain = sgain
|
||||
|
|
@ -1419,7 +1419,7 @@ class RandomFlip:
|
|||
|
||||
Examples:
|
||||
>>> flip = RandomFlip(p=0.5, direction="horizontal")
|
||||
>>> flip = RandomFlip(p=0.7, direction="vertical", flip_idx=[1, 0, 3, 2, 5, 4])
|
||||
>>> flip_with_idx = RandomFlip(p=0.7, direction="vertical", flip_idx=[1, 0, 3, 2, 5, 4])
|
||||
"""
|
||||
assert direction in {"horizontal", "vertical"}, f"Support direction `horizontal` or `vertical`, got {direction}"
|
||||
assert 0 <= p <= 1.0, f"The probability should be in range [0, 1], but got {p}."
|
||||
|
|
@ -2022,7 +2022,7 @@ class Format:
|
|||
Returns:
|
||||
(Dict): A dictionary with formatted data, including:
|
||||
- 'img': Formatted image tensor.
|
||||
- 'cls': Class labels tensor.
|
||||
- 'cls': Class label's tensor.
|
||||
- 'bboxes': Bounding boxes tensor in the specified format.
|
||||
- 'masks': Instance masks tensor (if return_mask is True).
|
||||
- 'keypoints': Keypoints tensor (if return_keypoint is True).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue