easi.predict¶
predict ¶
predict(
image: Any,
model: Any,
conf: float = 0.25,
slice_size: int | tuple[int, int] = 640,
overlap_ratio: float | tuple[float, float] = 0.2,
device: device | str | None = None,
half: bool | Literal["auto"] = "auto",
multi_label: bool = False,
**engine_kwargs: Any,
) -> Detections
Sliced detection on one image in one call.
Example::
import easi
det = easi.predict("aerial.jpg", "yolo11n.pt")
det.boxes, det.scores, det.labels, det.names
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
Any
|
File path, PIL image, NumPy |
required |
model
|
Any
|
Weights, model id or model object (see :func: |
required |
conf
|
float
|
Score threshold. |
0.25
|
slice_size
|
int | tuple[int, int]
|
Tile size; 640 matches YOLO's input size. |
640
|
overlap_ratio
|
float | tuple[float, float]
|
Tile overlap. |
0.2
|
device
|
device | str | None
|
Defaults to CUDA, then Apple MPS, then CPU. |
None
|
half
|
bool | Literal['auto']
|
|
'auto'
|
multi_label
|
bool
|
Ultralytics YOLO models only: also return a box's other likely classes
as separate, lower-scored detections (Ultralytics |
False
|
**engine_kwargs
|
Any
|
Further :class: |
{}
|
Models and engines are reused between calls, so predict with a model name or an
Ultralytics object is not thread-safe: for threads, give each its own adapter and
:class:~easi.EASI (see docs/THREADS.md).
detector_from ¶
detector_from(
model: Any,
conf: float = 0.25,
device: device | str | None = None,
half: bool | Literal["auto"] = "auto",
multi_label: bool = False,
) -> TorchDetector
Build (and cache for string ids) a detector adapter from a weights path, id, or model.
clear_cache ¶
Clear cached detectors (max 16), engines (max 16), and this thread's staging buffer.