--- id: sahi version: "0.12.5" license: MIT license_treatment: permissive maintenance: active --- # sahi — A vision library for performing sliced inference on large images/small objects License: permissive · Maintenance: active · Downloads: 281.2K/mo ## 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 above — 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 pip install sahi uv add sahi 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_current - Install friction: low - Maintenance: active - Downloads: 281.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sliced inference object detection, small object detection large images, image tiling detection, instance segmentation slicing, object detection preprocessing, vision inference optimization, detection model wrapper, object-detection, image-processing, computer-vision [View on SkillFed](https://skillfed.io/packages/sahi) · [View on PyPI](https://pypi.org/project/sahi/)