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
|
|
@ -1,6 +1,6 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.2.79"
|
__version__ = "8.2.80"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ from typing import List, Union
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
from ultralytics.cfg import TASK2DATA, get_cfg, get_save_dir
|
from ultralytics.cfg import TASK2DATA, get_cfg, get_save_dir
|
||||||
from ultralytics.engine.results import Results
|
from ultralytics.engine.results import Results
|
||||||
|
|
@ -143,7 +144,7 @@ class Model(nn.Module):
|
||||||
|
|
||||||
def __call__(
|
def __call__(
|
||||||
self,
|
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,
|
stream: bool = False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> list:
|
) -> list:
|
||||||
|
|
@ -504,7 +505,7 @@ class Model(nn.Module):
|
||||||
|
|
||||||
def predict(
|
def predict(
|
||||||
self,
|
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,
|
stream: bool = False,
|
||||||
predictor=None,
|
predictor=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|
@ -517,7 +518,7 @@ class Model(nn.Module):
|
||||||
types of image sources and can operate in a streaming mode.
|
types of image sources and can operate in a streaming mode.
|
||||||
|
|
||||||
Args:
|
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
|
of the image(s) to make predictions on. Accepts various types including file paths, URLs, PIL
|
||||||
images, numpy arrays, and torch tensors.
|
images, numpy arrays, and torch tensors.
|
||||||
stream (bool): If True, treats the input source as a continuous stream for predictions.
|
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