What is SAHI?
SAHI (Slicing Aided Hyper Inference) is a Python library for large-scale object detection and instance segmentation. Instead of feeding a whole high-resolution image to a model at once, it cuts the image into overlapping tiles, runs detection on each tile, and merges the results back together. It sits in the Vision & Understanding category of the Multimodal Generation tools and is open-source, written in Python and licensed MIT.
Overview
SAHI (Slicing Aided Hyper Inference) is a Python library for large-scale object detection and instance segmentation. Instead of feeding a whole high-resolution image to a model at once, it cuts the image into overlapping tiles, runs detection on each tile, and merges the results back together. This makes small objects much easier to find than running standard inference on a downscaled full frame.
It is aimed at computer-vision developers who already work with detection models and need better recall on tiny objects in big images, such as aerial, satellite, or surveillance footage. SAHI does not replace your model; it wraps one through a common interface and adds the slicing and merging logic around it.
It supports popular detection frameworks, including Ultralytics YOLO, MMDetection, Hugging Face, and TorchVision models, and offers both a Python API and a command-line tool. It also includes utilities for slicing COCO datasets and exploring predictions in FiftyOne.
What it does
- Sliced inference: splits large images into overlapping tiles so small objects are detected at full resolution
- Works with multiple model backends: Ultralytics YOLO, MMDetection, Hugging Face, and TorchVision
- Command-line predict tool for sliced or standard inference on images and video
- COCO slicing utilities to cut annotation and image files into tiles
- FiftyOne integration to visualize and compare prediction results
- Common AutoDetectionModel interface so you can swap models without rewriting the inference code
Getting started
Install SAHI from PyPI, then run sliced prediction from Python or the command line with any supported detection model.
Install
Install SAHI with pip. Add the model framework you plan to use (for example, Ultralytics) separately.
pip install sahiRun sliced prediction in Python
Load a model through AutoDetectionModel, then call get_sliced_prediction with your tile size and overlap ratios.
from sahi.predict import get_sliced_prediction
from sahi import AutoDetectionModel
# init any model
detection_model = AutoDetectionModel.from_pretrained(model_type='ultralytics',...)
# get sliced prediction result
result = get_sliced_prediction(
image,
detection_model,
slice_height = 256,
slice_width = 256,
overlap_height_ratio = 0.2,
overlap_width_ratio = 0.2
)Or use the CLI
The sahi predict command runs sliced or standard inference on an image, folder, or video using your chosen model_type and model_path.
sahi predict --model_path yolo26s.pt --model_type ultralytics --source video.mp4Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Detecting small objects in aerial or satellite imagery where targets are tiny relative to the full frame
- Improving recall on high-resolution surveillance or traffic footage without retraining the model
- Slicing a COCO dataset into tiles to train or evaluate detection models on smaller crops
- Comparing prediction results across models in FiftyOne, ordered by misdetections
How SAHI compares
SAHI alongside other open-source vision & understanding tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| PaddleOCR | ★ 93.5k | A toolkit for detecting and recognizing text in images across many languages, plus document parsing. |
| OpenCV | ★ 91.8k | The long-standing open-source computer-vision library for C++, Python and Java; version 5 rewrote the DNN engine and added ONNX-based LLM and VLM inference in-library. |
| Ultralytics YOLO | ★ 63.9k | A framework for training and running YOLO models for real-time object detection, segmentation, and tracking. |
| YOLOv5 | ★ 58.3k | Ultralytics' PyTorch repo for training, running and exporting YOLOv5 object-detection, instance-segmentation and classification models with plain scripts and PyTorch Hub. |
| Supervision | ★ 51.8k | A Python toolkit for processing, annotating, and visualizing detections and segmentations from many vision models. |
| MediaPipe | ★ 38k | Google's on-device ML framework: ready-to-run vision, text and audio tasks with one cross-platform API for Android, iOS, web, desktop and edge. |
| MMDetection | ★ 33.1k | An OpenMMLab toolbox with many object detection and instance segmentation algorithms for research and production. |
| SAHI | ★ 5.6k | Slicing-aided inference that catches small objects in large images |

