supervision
Libraryroboflow/supervision
Reusable computer vision tools for detection, tracking, and annotation.
Overview
Supervision provides a model-agnostic toolkit for loading datasets, annotating images, and tracking objects. It supports popular formats like COCO, Pascal VOC, and YOLO, and integrates with libraries such as Ultralytics, Transformers, and Inference. Built for rapid prototyping and deployment of computer vision applications.
README Preview
\n \n \n \n \n \n\n\n\n[notebooks](https://github.com/roboflow/notebooks) | [inference](https://github.com/roboflow/inference) | [autodistill](https://github.com/autodistill/autodistill) | [maestro](https://github.com/roboflow/multimodal-maestro)\n\n\n\n[](https://badge.fury.io/py/supervision)\n[](https://pypistats.org/packages/supervision)\n[](LICENSE.md)\n[](https://badge.fury.io/py/supervision)\n[](https://codecov.io/gh/roboflow/supervision)\n\n[](https://snyk.io/advisor/python/supervision)\n[](https://colab.research.google.com/github/roboflow/supervision/blob/main/demo.ipynb)\n[](https://huggingface.co/spaces/Roboflow/Annotators)\n[](https://discord.gg/GbfgXGJ8Bk)\n\n\n \n \n\n\n\n## 👋 hello\n\n**We are your essential toolkit for computer vision.** From data loading to real-time zone counting, we provide the building blocks so you can focus on building applications around your models. 🤝\n\n## 💻 install\n\nPip install the supervision package in a\n[**Python>=3.9**](https://www.python.org/) environment.\n\n```bash\npip install supervision\n```\n\nRead more about conda, mamba, and installing from source in our [guide](https://roboflow.github.io/supervision/).\n\n## 🔥 quickstart\n\n### models\n\nSupervision was designed to be model agnostic. Just plug in any classification, detection, or segmentation model. For your convenience, we have created [connectors](https://supervision.roboflow.com/latest/detection/core/#detections) for the most popular libraries like Ultralytics, Transformers, MMDetection, or Inference. Other integrations, like `rfdetr`, already return `sv.Detections` directly.\n\nInstall the optional dependencies for this example with `pip install pillow rfdetr`.\n\n```python\nimport supervision as sv\nfrom PIL import Image\nfrom rfdetr import RFDETRSmall\n\nimage = Image.open(...)\nmodel = RFDETRSmall()\ndetections = model.predict(image, threshold=0.5)\n\nlen(detections)\n# 5\n```\n\n\n👉 more model connectors\n\n- inference\n\n Ru
FAQ (5)
TroubleshootingWhy is Average Precision (AP) different from Precision at a single IoU threshold in object detection?
Average Precision (AP) and Precision at a fixed IoU threshold are distinct because AP is the area under the Precision-Recall curve, computed by varying the confidence score threshold while keeping the IoU threshold fixed (e.g., IoU=0.5). Precision at a single IoU threshold is a single point on that curve (TP/(TP+FP) at the chosen confidence and IoU). AP aggregates precision across all recall levels, giving a summary of the detector's performance, whereas single-threshold precision reflects performance at one operating point. This is why they can differ even in a single-class problem.
TroubleshootingWhy does my ultralytics model infer on the full image instead of the 512x512 slices defined in Supervision InferenceSlicer?
Ultralytics resizes inputs to the imgsz used during training. If your model was trained with imgsz=2048, it will upscale the 512x512 slice to 2048x2048 before inference. To fix, pass the desired slice size to the model: result = model(image, device='cuda', imgsz=512)[0]. Make sure imgsz matches the slice_wh set in InferenceSlicer.
TroubleshootingHow to fix 'ValueError: setting an array element with a sequence' in supervision when loading COCO dataset with multiple segmentation masks for the same class?
This error occurs in supervision 0.20.0 when a COCO annotation has multiple segmentation entries for a single object. As a temporary workaround, adapt the merge_multi_segment() function from Ultralytics’ general_json2yolo.py to merge multiple segmentation masks before loading. Track issue #1209 for a permanent fix.
TroubleshootingWhy do annotations have duplicate IDs when converting YOLO dataset to COCO with supervision's as_coco?
This is a known issue where each split (train, valid, test) generates its own annotation ID sequence, causing collisions. Workaround: merge all splits into one YOLO dataset, convert the merged dataset to COCO using as_coco, then re-split the COCO dataset into subsets while preserving continuous annotation IDs.
How-toHow to install supervision 0.26.0 via conda?
supervision 0.26.0 is now available on conda-forge. Install it with: conda install -c conda-forge supervision=0.26.0