`ultralytics 8.2.80` add PIL type hints to `model()` (#15719)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
pull/15751/head^2 v8.2.80
Josh Jarabek 3 months ago committed by GitHub
parent 5f93df6fca
commit 0c6e1e16bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/__init__.py
  2. 7
      ultralytics/engine/model.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.2.79"
__version__ = "8.2.80"
import os

@ -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.

Loading…
Cancel
Save