Fix Docs pretty __init__.py URLs (#14550)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-07-19 21:02:09 +02:00 committed by GitHub
parent 0d059bec0c
commit b3b3a15086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 49 additions and 22 deletions

View file

@ -280,6 +280,8 @@ class YOLOMultiModalDataset(YOLODataset):
class GroundingDataset(YOLODataset):
"""Handles object detection tasks by loading annotations from a specified JSON file, supporting YOLO format."""
def __init__(self, *args, task="detect", json_file, **kwargs):
"""Initializes a GroundingDataset for object detection, loading annotations from a specified JSON file."""
assert task == "detect", "`GroundingDataset` only support `detect` task for now!"

View file

@ -21,6 +21,8 @@ from .utils import get_sim_index_schema, get_table_schema, plot_query_result, pr
class ExplorerDataset(YOLODataset):
"""Extends YOLODataset for advanced data exploration and manipulation in model training workflows."""
def __init__(self, *args, data: dict = None, **kwargs) -> None:
"""Initializes the ExplorerDataset with the provided data arguments, extending the YOLODataset class."""
super().__init__(*args, data=data, **kwargs)
@ -54,6 +56,8 @@ class ExplorerDataset(YOLODataset):
class Explorer:
"""Utility class for image embedding, table creation, and similarity querying using LanceDB and YOLO models."""
def __init__(
self,
data: Union[str, Path] = "coco128.yaml",

View file

@ -930,6 +930,8 @@ class PSA(nn.Module):
class SCDown(nn.Module):
"""Spatial Channel Downsample (SCDown) module for reducing spatial and channel dimensions."""
def __init__(self, c1, c2, k, s):
"""
Spatial Channel Downsample (SCDown) module.

View file

@ -281,6 +281,8 @@ class Classify(nn.Module):
class WorldDetect(Detect):
"""Head for integrating YOLOv8 detection models with semantic understanding from text embeddings."""
def __init__(self, nc=80, embed=512, with_bn=False, ch=()):
"""Initialize YOLOv8 detection layer with nc classes and layer channels ch."""
super().__init__(nc, ch)

View file

@ -10,6 +10,8 @@ from ultralytics.utils.plotting import Annotator
class ParkingPtsSelection:
"""Class for selecting and managing parking zone points on images using a Tkinter-based UI."""
def __init__(self):
"""Initializes the UI for selecting parking zone points in a tkinter window."""
check_requirements("tkinter")
@ -154,6 +156,8 @@ class ParkingPtsSelection:
class ParkingManagement:
"""Manages parking occupancy and availability using YOLOv8 for real-time monitoring and visualization."""
def __init__(
self,
model_path,

View file

@ -164,6 +164,8 @@ def benchmark(
class RF100Benchmark:
"""Benchmark YOLO model performance across formats for speed and accuracy."""
def __init__(self):
"""Function for initialization of RF100Benchmark."""
self.ds_names = []

View file

@ -607,12 +607,10 @@ class v8ClassificationLoss:
class v8OBBLoss(v8DetectionLoss):
def __init__(self, model):
"""
Initializes v8OBBLoss with model, assigner, and rotated bbox loss.
"""Calculates losses for object detection, classification, and box distribution in rotated YOLO models."""
Note model must be de-paralleled.
"""
def __init__(self, model):
"""Initializes v8OBBLoss with model, assigner, and rotated bbox loss; note model must be de-paralleled."""
super().__init__(model)
self.assigner = RotatedTaskAlignedAssigner(topk=10, num_classes=self.nc, alpha=0.5, beta=6.0)
self.bbox_loss = RotatedBboxLoss(self.reg_max).to(self.device)

View file

@ -1221,6 +1221,8 @@ class ClassifyMetrics(SimpleClass):
class OBBMetrics(SimpleClass):
"""Metrics for evaluating oriented bounding box (OBB) detection, see https://arxiv.org/pdf/2106.06072.pdf."""
def __init__(self, save_dir=Path("."), plot=False, on_plot=None, names=()) -> None:
"""Initialize an OBBMetrics instance with directory, plotting, callback, and class names."""
self.save_dir = save_dir

View file

@ -259,6 +259,8 @@ class TaskAlignedAssigner(nn.Module):
class RotatedTaskAlignedAssigner(TaskAlignedAssigner):
"""Assigns ground-truth objects to rotated bounding boxes using a task-aligned metric."""
def iou_calculation(self, gt_bboxes, pd_bboxes):
"""IoU calculation for rotated bounding boxes."""
return probiou(gt_bboxes, pd_bboxes).squeeze(-1).clamp_(0)