{"id":4399,"library":"supervision","title":"supervision","description":"Supervision is a Python library providing a set of easy-to-use utilities for computer vision projects. It simplifies common tasks such as object detection, segmentation, pose estimation, and tracking by offering robust data structures, annotators, and metrics. The library is actively maintained with frequent releases, currently at version 0.27.0.post2.","status":"active","version":"0.27.0.post2","language":"en","source_language":"en","source_url":"https://github.com/roboflow/supervision","tags":["computer vision","object detection","segmentation","pose estimation","tracking","annotation","metrics","roboflow"],"install":[{"cmd":"pip install supervision","lang":"bash","label":"Core library"},{"cmd":"pip install supervision[all]","lang":"bash","label":"With all optional dependencies (e.g., for YOLO, OCR, SAM)"}],"dependencies":[{"reason":"Required for most image processing, annotation, and visualization functionalities. Not a core dependency, but almost universally needed.","package":"opencv-python","optional":true},{"reason":"Fundamental for numerical operations and array handling with image data and detection results.","package":"numpy","optional":true}],"imports":[{"note":"The canonical way to import and use the library, accessing classes like sv.Detections, sv.BoxAnnotator, etc.","symbol":"supervision as sv","correct":"import supervision as sv"},{"symbol":"Detections","correct":"import supervision as sv\ndetections = sv.Detections(...)"},{"symbol":"BoxAnnotator","correct":"import supervision as sv\nannotator = sv.BoxAnnotator()"}],"quickstart":{"code":"import supervision as sv\nimport numpy as np\nimport cv2\n\n# Simulate an image (e.g., loaded from file or camera feed)\nimage_height, image_width = 720, 1280\nimage = np.zeros((image_height, image_width, 3), dtype=np.uint8)\ncv2.rectangle(image, (100, 100), (300, 300), (255, 255, 255), -1)\ncv2.putText(image, \"Dummy Image\", (500, 360), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)\n\n# Simulate object detections (e.g., from a YOLO model)\ndetections = sv.Detections(\n    xyxy=np.array([[150, 150, 250, 250], [500, 500, 600, 600]]),\n    confidence=np.array([0.9, 0.8]),\n    class_id=np.array([0, 1]),\n    tracker_id=np.array([1, 2]),\n    class_name=np.array(['person', 'car'])\n)\n\n# Create an annotator (e.g., for bounding boxes)\nbox_annotator = sv.BoxAnnotator(\n    thickness=2, \n    text_thickness=2, \n    text_scale=1\n)\n\n# Annotate the image with the simulated detections\nannotated_image = box_annotator.annotate(\n    scene=image.copy(),\n    detections=detections,\n    labels=[f\"Class {class_id} {confidence:.2f}\" for class_id, confidence in zip(detections.class_id, detections.confidence)]\n)\n\n# In a real application, you would display or save 'annotated_image'\n# For this quickstart, we'll print confirmation.\nprint(f\"Annotated image shape: {annotated_image.shape}\")\nassert annotated_image.shape == image.shape\nprint(\"Supervision quickstart example ran successfully.\")\n# Example of saving the image:\n# cv2.imwrite(\"annotated_output.jpg\", annotated_image)","lang":"python","description":"This quickstart demonstrates how to create dummy image data and detections, then use `sv.BoxAnnotator` to visualize them. This minimal example does not require an external deep learning model, only `numpy` and `opencv-python` (which are often installed automatically with `supervision[all]` or manually needed for CV tasks)."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. `supervision` also supports Python 3.13+.","message":"Python 3.8 support was dropped in version 0.26.0. Users on older Python versions must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":"0.26.0 and later"},{"fix":"Upgrade to `supervision==0.26.1` or newer to ensure correct `MeanAveragePrecision` calculations, especially for size-specific evaluations.","message":"The `sv.MeanAveragePrecision` metric had a bug prior to version 0.26.1 where the area used for size-specific evaluation (small/medium/large) was always zero unless explicitly provided. This could lead to incorrect mAP results for those specific categories.","severity":"gotcha","affected_versions":"Prior to 0.26.1"},{"fix":"Review existing `LineZone` implementations after upgrading to 0.25.0+ to ensure continued correct behavior. Refer to the official documentation for the latest usage patterns.","message":"The `LineZone` and related components received significant updates in version 0.25.0. While enhancing robustness, existing implementations of line-zone counting might experience behavioral changes or require minor adjustments, especially concerning edge cases or specific crossing logic.","severity":"gotcha","affected_versions":"0.25.0 and later"},{"fix":"Ensure `opencv-python` and `numpy` are installed (`pip install opencv-python numpy`) if you plan to use any image annotation or processing features. Alternatively, `pip install supervision[all]` will include these.","message":"Many core functionalities (e.g., annotators, image processing utilities) within `supervision` rely on `opencv-python` and `numpy`. While `supervision` can be installed without these as strict dependencies, attempting to use these features without them will result in `ImportError` or other runtime errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}