diff --git a/docs/en/hub/datasets.md b/docs/en/hub/datasets.md index c257279853..487e56776b 100644 --- a/docs/en/hub/datasets.md +++ b/docs/en/hub/datasets.md @@ -98,6 +98,18 @@ Next, [train a model](./models.md#train-model) on your dataset. ![Ultralytics HUB screenshot of the Dataset page with an arrow pointing to the Train Model button](https://raw.githubusercontent.com/ultralytics/assets/main/docs/hub/datasets/hub_upload_dataset_9.jpg) +## Download Dataset + +Navigate to the Dataset page of the dataset you want to download, open the dataset actions dropdown and click on the **Download** option. This action will start downloading your dataset. + +![Ultralytics HUB screenshot of the Dataset page with an arrow pointing to the Download option](https://raw.githubusercontent.com/ultralytics/assets/main/docs/hub/datasets/hub_download_dataset_1.jpg) + +??? tip "Tip" + + You can download a dataset directly from the [Datasets](https://hub.ultralytics.com/datasets) page. + + ![Ultralytics HUB screenshot of the Datasets page with an arrow pointing to the Download option of one of the datasets](https://raw.githubusercontent.com/ultralytics/assets/main/docs/hub/datasets/hub_download_dataset_2.jpg) + ## Share Dataset !!! info "Info" diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 93ca50b1ac..a03cb559e0 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.2.79" +__version__ = "8.2.80" import os diff --git a/ultralytics/engine/model.py b/ultralytics/engine/model.py index ad29559ac5..ddbfa9de5e 100644 --- a/ultralytics/engine/model.py +++ b/ultralytics/engine/model.py @@ -6,6 +6,7 @@ from typing import List, Union import numpy as np import torch +from PIL import Image from ultralytics.cfg import TASK2DATA, get_cfg, get_save_dir from ultralytics.engine.results import Results @@ -143,7 +144,7 @@ class Model(nn.Module): def __call__( self, - source: Union[str, Path, int, list, tuple, np.ndarray, torch.Tensor] = None, + source: Union[str, Path, int, Image.Image, list, tuple, np.ndarray, torch.Tensor] = None, stream: bool = False, **kwargs, ) -> list: @@ -504,7 +505,7 @@ class Model(nn.Module): def predict( self, - source: Union[str, Path, int, list, tuple, np.ndarray, torch.Tensor] = None, + source: Union[str, Path, int, Image.Image, list, tuple, np.ndarray, torch.Tensor] = None, stream: bool = False, predictor=None, **kwargs, @@ -517,7 +518,7 @@ class Model(nn.Module): types of image sources and can operate in a streaming mode. Args: - source (str | Path | int | List[str] | List[Path] | List[int] | np.ndarray | torch.Tensor): The source + source (str | Path | int | PIL.Image | np.ndarray | torch.Tensor | List | Tuple): The source of the image(s) to make predictions on. Accepts various types including file paths, URLs, PIL images, numpy arrays, and torch tensors. stream (bool): If True, treats the input source as a continuous stream for predictions. @@ -900,7 +901,7 @@ class Model(nn.Module): initialized, it sets it up before retrieving the names. Returns: - (List[str]): A list of class names associated with the model. + (Dict[int, str]): A dict of class names associated with the model. Raises: AttributeError: If the model or predictor does not have a 'names' attribute. @@ -908,7 +909,7 @@ class Model(nn.Module): Examples: >>> model = YOLO('yolov8n.pt') >>> print(model.names) - ['person', 'bicycle', 'car', ...] + {0: 'person', 1: 'bicycle', 2: 'car', ...} """ from ultralytics.nn.autobackend import check_class_names diff --git a/ultralytics/utils/metrics.py b/ultralytics/utils/metrics.py index 80c2f66083..78c77c7261 100644 --- a/ultralytics/utils/metrics.py +++ b/ultralytics/utils/metrics.py @@ -445,7 +445,7 @@ def smooth(y, f=0.05): @plt_settings() -def plot_pr_curve(px, py, ap, save_dir=Path("pr_curve.png"), names=(), on_plot=None): +def plot_pr_curve(px, py, ap, save_dir=Path("pr_curve.png"), names={}, on_plot=None): """Plots a precision-recall curve.""" fig, ax = plt.subplots(1, 1, figsize=(9, 6), tight_layout=True) py = np.stack(py, axis=1) @@ -470,7 +470,7 @@ def plot_pr_curve(px, py, ap, save_dir=Path("pr_curve.png"), names=(), on_plot=N @plt_settings() -def plot_mc_curve(px, py, save_dir=Path("mc_curve.png"), names=(), xlabel="Confidence", ylabel="Metric", on_plot=None): +def plot_mc_curve(px, py, save_dir=Path("mc_curve.png"), names={}, xlabel="Confidence", ylabel="Metric", on_plot=None): """Plots a metric-confidence curve.""" fig, ax = plt.subplots(1, 1, figsize=(9, 6), tight_layout=True) @@ -528,7 +528,7 @@ def compute_ap(recall, precision): def ap_per_class( - tp, conf, pred_cls, target_cls, plot=False, on_plot=None, save_dir=Path(), names=(), eps=1e-16, prefix="" + tp, conf, pred_cls, target_cls, plot=False, on_plot=None, save_dir=Path(), names={}, eps=1e-16, prefix="" ): """ Computes the average precision per class for object detection evaluation. @@ -541,7 +541,7 @@ def ap_per_class( plot (bool, optional): Whether to plot PR curves or not. Defaults to False. on_plot (func, optional): A callback to pass plots path and data when they are rendered. Defaults to None. save_dir (Path, optional): Directory to save the PR curves. Defaults to an empty path. - names (tuple, optional): Tuple of class names to plot PR curves. Defaults to an empty tuple. + names (dict, optional): Dict of class names to plot PR curves. Defaults to an empty tuple. eps (float, optional): A small value to avoid division by zero. Defaults to 1e-16. prefix (str, optional): A prefix string for saving the plot files. Defaults to an empty string. @@ -799,13 +799,13 @@ class DetMetrics(SimpleClass): save_dir (Path): A path to the directory where the output plots will be saved. Defaults to current directory. plot (bool): A flag that indicates whether to plot precision-recall curves for each class. Defaults to False. on_plot (func): An optional callback to pass plots path and data when they are rendered. Defaults to None. - names (tuple of str): A tuple of strings that represents the names of the classes. Defaults to an empty tuple. + names (dict of str): A dict of strings that represents the names of the classes. Defaults to an empty tuple. Attributes: save_dir (Path): A path to the directory where the output plots will be saved. plot (bool): A flag that indicates whether to plot the precision-recall curves for each class. on_plot (func): An optional callback to pass plots path and data when they are rendered. - names (tuple of str): A tuple of strings that represents the names of the classes. + names (dict of str): A dict of strings that represents the names of the classes. box (Metric): An instance of the Metric class for storing the results of the detection metrics. speed (dict): A dictionary for storing the execution time of different parts of the detection process. @@ -822,7 +822,7 @@ class DetMetrics(SimpleClass): curves_results: TODO """ - def __init__(self, save_dir=Path("."), plot=False, on_plot=None, names=()) -> None: + def __init__(self, save_dir=Path("."), plot=False, on_plot=None, names={}) -> None: """Initialize a DetMetrics instance with a save directory, plot flag, callback function, and class names.""" self.save_dir = save_dir self.plot = plot