Fix v8_transforms docstring example (#17630)

pull/17631/head^2
Mohammed Yasin 6 days ago committed by GitHub
parent 121307a246
commit dc9b99214f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      ultralytics/data/augment.py

@ -2280,7 +2280,7 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False):
Args: Args:
dataset (Dataset): The dataset object containing image data and annotations. dataset (Dataset): The dataset object containing image data and annotations.
imgsz (int): The target image size for resizing. imgsz (int): The target image size for resizing.
hyp (Dict): A dictionary of hyperparameters controlling various aspects of the transformations. hyp (Namespace): A dictionary of hyperparameters controlling various aspects of the transformations.
stretch (bool): If True, applies stretching to the image. If False, uses LetterBox resizing. stretch (bool): If True, applies stretching to the image. If False, uses LetterBox resizing.
Returns: Returns:
@ -2288,8 +2288,9 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False):
Examples: Examples:
>>> from ultralytics.data.dataset import YOLODataset >>> from ultralytics.data.dataset import YOLODataset
>>> from ultralytics.utils import IterableSimpleNamespace
>>> dataset = YOLODataset(img_path="path/to/images", imgsz=640) >>> dataset = YOLODataset(img_path="path/to/images", imgsz=640)
>>> hyp = {"mosaic": 1.0, "copy_paste": 0.5, "degrees": 10.0, "translate": 0.2, "scale": 0.9} >>> hyp = IterableSimpleNamespace(mosaic=1.0, copy_paste=0.5, degrees=10.0, translate=0.2, scale=0.9)
>>> transforms = v8_transforms(dataset, imgsz=640, hyp=hyp) >>> transforms = v8_transforms(dataset, imgsz=640, hyp=hyp)
>>> augmented_data = transforms(dataset[0]) >>> augmented_data = transforms(dataset[0])
""" """

Loading…
Cancel
Save