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>
This commit is contained in:
parent
5f93df6fca
commit
0c6e1e16bd
2 changed files with 5 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue