The EASI engine¶
EASI ¶
EASI(
slice_size: int | tuple[int, int] = 640,
overlap_ratio: float | tuple[float, float] = 0.2,
batch_size: int | Literal["auto"] = 8,
fusion_mode: FusionMode = "seam_wbf",
iou_threshold: float | None = None,
class_agnostic: bool = False,
full_frame_pass: bool = False,
full_frame_size: int | None = None,
zoom_size: int | None = None,
zoom_min_boxes: int = 10,
flip_tta: bool = False,
dtype: dtype | None = None,
channels_last: bool = False,
edge_tolerance: float | None = None,
postprocess_device: device | str | None = "auto",
seam_min_score: float = 0.5,
edge_cleanup: EdgeCleanup | bool = "balanced",
whole_view_gate: WholeViewGate | bool = "class",
fusion_edge_tolerance: float = FUSION_EDGE_TOLERANCE,
)
Sliced inference that keeps the image and every box on the image's device.
Example::
engine = EASI(slice_size=640, overlap_ratio=0.2, batch_size=8)
detections = engine.predict(image_tensor, UltralyticsAdapter("yolo11n.pt"))
detections.boxes, detections.scores, detections.labels
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slice_size
|
int | tuple[int, int]
|
Tile size, |
640
|
overlap_ratio
|
float | tuple[float, float]
|
Tile overlap fraction in |
0.2
|
batch_size
|
int | Literal['auto']
|
Tiles per detector call, or |
8
|
fusion_mode
|
FusionMode
|
|
'seam_wbf'
|
iou_threshold
|
float | None
|
IoU threshold for clustering/NMS (default 0.6 seam, 0.5 plain). |
None
|
class_agnostic
|
bool
|
Fuse boxes regardless of label. |
False
|
full_frame_pass
|
bool
|
Also run the detector once on the whole image at |
False
|
full_frame_size
|
int | None
|
Whole-image pass input size (longer side; shorter side stride-aligned). |
None
|
zoom_size
|
int | None
|
Selective 2nd-pass input size for tiles with |
None
|
zoom_min_boxes
|
int
|
Small-box count threshold for |
10
|
flip_tta
|
bool
|
Also run left-right mirrored tiles and merge views via :func: |
False
|
dtype
|
dtype | None
|
Cast tiles to this dtype before the detector; |
None
|
channels_last
|
bool
|
Pass tiles in |
False
|
edge_tolerance
|
float | None
|
Pixels within which a box counts as cut by a tile edge (default 2% of the smaller slice side). |
None
|
fusion_edge_tolerance
|
float
|
Edge tolerance for fusion steps (default 2.0 px). |
FUSION_EDGE_TOLERANCE
|
postprocess_device
|
device | str | None
|
|
'auto'
|
seam_min_score
|
float
|
Minimum score for boxes to join seam fusion (default 0.5). |
0.5
|
edge_cleanup
|
EdgeCleanup | bool
|
Drop cut fragments covered by fuller boxes ( |
'balanced'
|
whole_view_gate
|
WholeViewGate | bool
|
Drop cut boxes covered by a whole-tile box before seam fusion
( |
'class'
|
CPU_FUSION_MAX_BOXES
class-attribute
instance-attribute
¶
postprocess_device="auto" fuses frames with at most this many raw boxes on the CPU.
AUTO_BATCH_MEMORY_FRACTION
class-attribute
instance-attribute
¶
batch_size="auto" plans batches to use at most this share of free GPU memory.
AUTO_BATCH_MAX
class-attribute
instance-attribute
¶
Largest batch batch_size="auto" picks.
AUTO_BATCH_WITHOUT_CUDA
class-attribute
instance-attribute
¶
batch_size="auto" without CUDA memory statistics.
EDGE_TOLERANCE_FRACTION
class-attribute
instance-attribute
¶
Default edge_tolerance as a share of the smaller slice side (at least 2 px).
ZOOM_SMALL_SIDE
class-attribute
instance-attribute
¶
zoom_size: a box counts as small when its longer side is under this (image px).
ZOOM_MIN_SCORE
class-attribute
instance-attribute
¶
zoom_size: only boxes scoring at least this count towards zoom_min_boxes.
predict ¶
Detect objects in one image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
Tensor
|
|
required |
detector
|
TorchDetector
|
Callable mapping a |
required |
timer
|
StageTimer | None
|
Optional :class: |
None
|
predict_raw ¶
predict_raw(
image: Tensor, detector: TorchDetector, timer: StageTimer | None = None
) -> tuple[CanvasDetections, torch.Tensor, tuple[int, int]]
Run slicing and detection without fusing, returning raw canvas detections and windows.