Ruff Docstring formatting (#15793)
Signed-off-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
d27664216b
commit
776ca86369
60 changed files with 241 additions and 309 deletions
|
|
@ -1005,7 +1005,6 @@ class RandomPerspective:
|
|||
>>> transform = RandomPerspective(degrees=10.0, translate=0.1, scale=0.5, shear=5.0)
|
||||
>>> result = transform(labels) # Apply random perspective to labels
|
||||
"""
|
||||
|
||||
self.degrees = degrees
|
||||
self.translate = translate
|
||||
self.scale = scale
|
||||
|
|
@ -1038,7 +1037,6 @@ class RandomPerspective:
|
|||
>>> border = (10, 10)
|
||||
>>> transformed_img, matrix, scale = affine_transform(img, border)
|
||||
"""
|
||||
|
||||
# Center
|
||||
C = np.eye(3, dtype=np.float32)
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ def coco91_to_coco80_class():
|
|||
|
||||
|
||||
def coco80_to_coco91_class():
|
||||
"""
|
||||
r"""
|
||||
Converts 80-index (val2014) to 91-index (paper).
|
||||
For details see https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/.
|
||||
|
||||
|
|
@ -243,7 +243,6 @@ def convert_coco(
|
|||
Output:
|
||||
Generates output files in the specified output directory.
|
||||
"""
|
||||
|
||||
# Create dataset directory
|
||||
save_dir = increment_path(save_dir) # increment if save directory already exists
|
||||
for p in save_dir / "labels", save_dir / "images":
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ class Explorer:
|
|||
def plot_sql_query(self, query: str, labels: bool = True) -> Image.Image:
|
||||
"""
|
||||
Plot the results of a SQL-Like query on the table.
|
||||
|
||||
Args:
|
||||
query (str): SQL query to run.
|
||||
labels (bool): Whether to plot the labels or not.
|
||||
|
|
@ -457,20 +458,3 @@ class Explorer:
|
|||
LOGGER.error("AI generated query is not valid. Please try again with a different prompt")
|
||||
LOGGER.error(e)
|
||||
return None
|
||||
|
||||
def visualize(self, result):
|
||||
"""
|
||||
Visualize the results of a query. TODO.
|
||||
|
||||
Args:
|
||||
result (pyarrow.Table): Table containing the results of a query.
|
||||
"""
|
||||
pass
|
||||
|
||||
def generate_report(self, result):
|
||||
"""
|
||||
Generate a report of the dataset.
|
||||
|
||||
TODO
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ class LoadScreenshots:
|
|||
return self
|
||||
|
||||
def __next__(self):
|
||||
"""mss screen capture: get raw pixels from the screen as np array."""
|
||||
"""Screen capture with 'mss' to get raw pixels from the screen as np array."""
|
||||
im0 = np.asarray(self.sct.grab(self.monitor))[:, :, :3] # BGRA to BGR
|
||||
s = f"screen {self.screen} (LTWH): {self.left},{self.top},{self.width},{self.height}: "
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,19 @@ from shapely.geometry import Polygon
|
|||
|
||||
def bbox_iof(polygon1, bbox2, eps=1e-6):
|
||||
"""
|
||||
Calculate iofs between bbox1 and bbox2.
|
||||
Calculate Intersection over Foreground (IoF) between polygons and bounding boxes.
|
||||
|
||||
Args:
|
||||
polygon1 (np.ndarray): Polygon coordinates, (n, 8).
|
||||
bbox2 (np.ndarray): Bounding boxes, (n ,4).
|
||||
polygon1 (np.ndarray): Polygon coordinates, shape (n, 8).
|
||||
bbox2 (np.ndarray): Bounding boxes, shape (n, 4).
|
||||
eps (float, optional): Small value to prevent division by zero. Defaults to 1e-6.
|
||||
|
||||
Returns:
|
||||
(np.ndarray): IoF scores, shape (n, 1) or (n, m) if bbox2 is (m, 4).
|
||||
|
||||
Note:
|
||||
Polygon format: [x1, y1, x2, y2, x3, y3, x4, y4].
|
||||
Bounding box format: [x_min, y_min, x_max, y_max].
|
||||
"""
|
||||
polygon1 = polygon1.reshape(-1, 4, 2)
|
||||
lt_point = np.min(polygon1, axis=-2) # left-top
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ def check_det_dataset(dataset, autodownload=True):
|
|||
Returns:
|
||||
(dict): Parsed dataset information and paths.
|
||||
"""
|
||||
|
||||
file = check_file(dataset)
|
||||
|
||||
# Download (optional)
|
||||
|
|
@ -363,7 +362,6 @@ def check_cls_dataset(dataset, split=""):
|
|||
- 'nc' (int): The number of classes in the dataset.
|
||||
- 'names' (dict): A dictionary of class names in the dataset.
|
||||
"""
|
||||
|
||||
# Download (optional if dataset=https://file.zip is passed directly)
|
||||
if str(dataset).startswith(("http:/", "https:/")):
|
||||
dataset = safe_download(dataset, dir=DATASETS_DIR, unzip=True, delete=False)
|
||||
|
|
@ -602,7 +600,6 @@ def compress_one_image(f, f_new=None, max_dim=1920, quality=50):
|
|||
compress_one_image(f)
|
||||
```
|
||||
"""
|
||||
|
||||
try: # use PIL
|
||||
im = Image.open(f)
|
||||
r = max_dim / max(im.height, im.width) # ratio
|
||||
|
|
@ -635,7 +632,6 @@ def autosplit(path=DATASETS_DIR / "coco8/images", weights=(0.9, 0.1, 0.0), annot
|
|||
autosplit()
|
||||
```
|
||||
"""
|
||||
|
||||
path = Path(path) # images dir
|
||||
files = sorted(x for x in path.rglob("*.*") if x.suffix[1:].lower() in IMG_FORMATS) # image files only
|
||||
n = len(files) # number of files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue