skillfed

sahi

A vision library for performing sliced inference on large images/small objects

sahi v0.12.5 281.2K downloads/30d#8,102 on PyPI5,466
Permissive license MIT Active released

What it is and what it does

SAHI is a lightweight wrapper library that enables sliced inference—a technique for improving object detection on large images containing small objects. Instead of running detection on the full image at once, SAHI divides the image into overlapping tiles, runs inference on each tile independently, and merges the predictions back together. This approach helps detection models see small objects at higher effective resolution, which often improves accuracy on objects that would otherwise be missed or poorly localized.

The library integrates with popular detection frameworks (ultralytics, mmdet, huggingface, torchvision, roboflow) and provides both programmatic APIs and command-line tools. It includes utilities for dataset slicing, COCO evaluation, error analysis, and visualization. Runtime dependencies are standard data-processing libraries (numpy, opencv-python, pillow, matplotlib, shapely, requests, pyyaml, click, fire, tqdm), making it straightforward to add to existing computer vision pipelines.

Use it for:

  • Detect small objects in aerial or satellite imagery by slicing large images into manageable tiles.
  • Improve detection accuracy on crowded scenes where objects are densely packed and small relative to image size.
  • Preprocess datasets by automatically slicing COCO-annotated images and converting between annotation formats.
  • Evaluate detection model performance on large images using built-in COCO evaluation and error analysis tools.
  • Prototype detection pipelines with multiple frameworks without rewriting inference code.
  • Analyze detection failures across a dataset and export error plots for model debugging.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SAHI performs sliced inference on large images to detect and segment small objects, breaking images into overlapping tiles for processing by detection models and merging results.

Yes. SAHI is actively maintained, has no security vulnerabilities, and solves a real problem in object detection on large images. Install it if you work with large images containing small objects or need a framework-agnostic wrapper for detection inference. The low install friction and permissive license make it a low-risk addition to a computer vision project.

Install

sahi on PyPI

pip

pip install sahi

uv

uv add sahi

poetry

poetry add sahi

Installing sahi

Before you install

Low install friction with a pure-Python wheel and no compiled dependencies. Active maintenance with a recent release (11 days ago) and steady repository activity.

License in practice

MIT license permits commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install sahi

from sahi.prediction import get_prediction
from sahi.models.detection import Yolov8DetectionModel

model = Yolov8DetectionModel(model_type="yolov8m", device="cpu")
results = get_prediction(image_path="image.jpg", detection_model=model)

Requires a detection framework (ultralytics, mmdet, huggingface, torchvision, or roboflow) to be installed separately; PyTorch and torchvision are also required dependencies not bundled with SAHI.

Verify before relying

  • Whether sliced inference provides measurable accuracy gains on your specific object sizes and image resolutions.
  • Performance overhead of tiling and merging compared to full-image inference on your hardware.
  • Compatibility matrix between SAHI version 0.12.5 and specific detection framework versions.
  • Tile dimensions and overlap strategy supported by the slicing API.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 10 — click, fire, matplotlib, numpy, opencv-python, pillow, pyyaml, requests, shapely, tqdm
Maintenance actively maintained — 11 days since the last release
Last repo commit
First released
Downloads 281,218/month — #8,102 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sahi-0.12.5-py3-none-any.whl

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

sliced inference object detectionsmall object detection large imagesimage tiling detectioninstance segmentation slicingobject detection preprocessingvision inference optimizationdetection model wrapper
object-detectionimage-processingcomputer-vision

More Libraries packages

Further reading