Overview
SAHI helps developers overcome real-world challenges in object detection by enabling sliced inference for detecting small objects in large images. It supports various popular detection models and provides easy-to-use APIs.
| Command | Description |
|---|---|
| predict | Perform sliced/standard video/image prediction using any ultralytics / mmdet / huggingface / torchvision model — see CLI guide |
| predict-fiftyone | Perform sliced/standard prediction using any supported model and explore results in fiftyone app — learn more |
| coco slice | Automatically slice COCO annotation and image files — see slicing utilities |
| coco fiftyone | Explore multiple prediction results on your COCO dataset with fiftyone ui ordered by number of misdetections |
| coco evaluate | Evaluate classwise COCO AP and AR for given predictions and ground truth — check COCO utilities |
| coco analyse | Calculate and export many error analysis plots — see the complete guide |
| coco yolo | Automatically convert any COCO dataset to ultralytics format |
📜 List of publications that cite SAHI (currently 600+)
🏆 List of competition winners that used SAHI
SAHI's documentation is indexed in Context7 MCP, providing AI coding assistants with up-to-date, version-specific code examples and API references. We also provide an llms.txt file following the emerging standard for AI-readable documentation. To integrate SAHI docs with your AI development workflow, check out the Context7 MCP installation guide.
Installation
pip install sahi
Detailed Installation (Click to open)
pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu126
(torch 2.1.2 is required for mmdet support):
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
pip install ultralytics>=8.3.161
pip install transformers>=4.49.0 timm
pip install yolov5==7.0.14 sahi==0.12.1
pip install mim
mim install mmdet==3.3.0
pip install inference>=0.51.5 rfdetr>=1.6.2
Quick Start
| Resource | Type |
|---|---|
| Introduction to SAHI | Blog Post |
| 2025 Video Tutorial ⭐ | Video |
| Official Paper (ICIP 2022 oral) | Paper |
| Pretrained Weights & ICIP 2022 Paper Files | Benchmark |
| Visualizing and Evaluating SAHI Predictions with FiftyOne | Blog Post |
| Exploring SAHI – learnopencv.com | Article |
| Slicing Aided Hyper Inference Explained by Encord | Article |
| Video Tutorial: SAHI for Small Object Detection | Video |
| Satellite Object Detection | Blog Post |
| COCO Dataset Conversion | Blog Post |
| Kaggle Notebook | Notebook |
| Error Analysis Plots & Evaluation ⭐ | Discussion |
| Interactive Result Visualization and Inspection ⭐ | Discussion |
| Video Inference Support | Discussion |
| Slicing Operation Notebook | Notebook |
| Complete Documentation | Docs |
| Framework | Notebook | Demo | | ------------------ | ---------------------------------------------------------------------------------------------