Ultralytics Code Refactor https://ultralytics.com/actions (#14109)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
ff63a56a42
commit
691b5daccb
16 changed files with 124 additions and 113 deletions
|
|
@ -22,6 +22,7 @@ from .utils import get_sim_index_schema, get_table_schema, plot_query_result, pr
|
|||
|
||||
class ExplorerDataset(YOLODataset):
|
||||
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)
|
||||
|
||||
def load_image(self, i: int) -> Union[Tuple[np.ndarray, Tuple[int, int], Tuple[int, int]], Tuple[None, None, None]]:
|
||||
|
|
@ -59,6 +60,7 @@ class Explorer:
|
|||
model: str = "yolov8n.pt",
|
||||
uri: str = USER_CONFIG_DIR / "explorer",
|
||||
) -> None:
|
||||
"""Initializes the Explorer class with dataset path, model, and URI for database connection."""
|
||||
# Note duckdb==0.10.0 bug https://github.com/ultralytics/ultralytics/pull/8181
|
||||
checks.check_requirements(["lancedb>=0.4.3", "duckdb<=0.9.2"])
|
||||
import lancedb
|
||||
|
|
@ -416,6 +418,7 @@ class Explorer:
|
|||
def _check_imgs_or_idxs(
|
||||
self, img: Union[str, np.ndarray, List[str], List[np.ndarray], None], idx: Union[None, int, List[int]]
|
||||
) -> List[np.ndarray]:
|
||||
"""Determines whether to fetch images or indexes based on provided arguments and returns image paths."""
|
||||
if img is None and idx is None:
|
||||
raise ValueError("Either img or idx must be provided.")
|
||||
if img is not None and idx is not None:
|
||||
|
|
|
|||
|
|
@ -230,6 +230,8 @@ class HUBTrainingSession:
|
|||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
"""Attempts to execute `request_func` with retries, timeout handling, optional threading, and progress."""
|
||||
|
||||
def retry_request():
|
||||
"""Attempts to call `request_func` with retries, timeout, and optional threading."""
|
||||
t0 = time.time() # Record the start time for the timeout
|
||||
|
|
|
|||
|
|
@ -712,6 +712,7 @@ class RepVGGDW(torch.nn.Module):
|
|||
"""RepVGGDW is a class that represents a depth wise separable convolutional block in RepVGG architecture."""
|
||||
|
||||
def __init__(self, ed) -> None:
|
||||
"""Initializes RepVGGDW with depthwise separable convolutional layers for efficient processing."""
|
||||
super().__init__()
|
||||
self.conv = Conv(ed, ed, 7, 1, 3, g=ed, act=False)
|
||||
self.conv1 = Conv(ed, ed, 3, 1, 1, g=ed, act=False)
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ class AIGym:
|
|||
|
||||
# Check if environment supports imshow
|
||||
self.env_check = check_imshow(warn=True)
|
||||
self.count = list()
|
||||
self.angle = list()
|
||||
self.stage = list()
|
||||
self.count = []
|
||||
self.angle = []
|
||||
self.stage = []
|
||||
|
||||
def start_counting(self, im0, results):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -305,7 +305,6 @@ class ThreadingLocked:
|
|||
@ThreadingLocked()
|
||||
def my_function():
|
||||
# Your code here
|
||||
pass
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1224,6 +1224,7 @@ class ClassifyMetrics(SimpleClass):
|
|||
|
||||
class OBBMetrics(SimpleClass):
|
||||
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
|
||||
self.plot = plot
|
||||
self.on_plot = on_plot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue