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