@@ -12,6 +12,7 @@ Please read and adhere to our [Code of Conduct](https://supervision.roboflow.com
1212
1313- [ Contribution Guidelines] ( #contribution-guidelines )
1414 - [ Contributing Features] ( #contributing-features )
15+ - [ API Design Principles] ( #api-design-principles )
1516- [ How to Contribute Changes] ( #how-to-contribute-changes )
1617- [ Installation for Contributors] ( #installation-for-contributors )
1718- [ Code Style and Quality] ( #code-style-and-quality )
@@ -41,6 +42,38 @@ For example, counting objects that cross a line anywhere on an image is a common
4142
4243Before you contribute a new feature, consider submitting an Issue to discuss the feature so the community can weigh in and assist.
4344
45+ ### API Design Principles
46+
47+ Supervision APIs should remain generic, composable, and predictable across model
48+ families. Before adding a new integration, annotator option, or data conversion
49+ method, check the existing ` sv.Detections ` , ` sv.KeyPoints ` , and annotator
50+ patterns and follow these principles:
51+
52+ 1 . ** Model integrations normalize raw external outputs into existing Supervision
53+ containers.** Use ` sv.Detections ` for detection, segmentation, and other
54+ instance-level predictions that include boxes, masks, class ids, confidence
55+ scores, or extra per-instance fields. Use ` sv.KeyPoints ` for standalone
56+ keypoint or pose predictions.
57+ 2 . ** Do not add a ` from_<model> ` method when the model already returns a
58+ Supervision object.** ` from_* ` methods are for converting raw outputs from
59+ external packages such as Ultralytics, Transformers, Inference, or MediaPipe.
60+ If a model's ` predict() ` method already returns ` sv.Detections ` , keep that
61+ result type and store additional structured payloads in ` detections.data ` or
62+ ` detections.metadata ` using documented keys.
63+ 3 . ** Annotators render data; filtering and visibility are container state.**
64+ Filtering by confidence, class id, tracker id, geometry, or custom data should
65+ happen before annotation through the container slicing APIs, for example
66+ ` detections[detections.confidence > 0.7] ` or an equivalent ` sv.KeyPoints `
67+ filter. Per-point presentation state, such as a ` KeyPoints.visible ` mask, may
68+ live on the container and be honored consistently by annotators.
69+ 4 . ** Annotator constructor arguments should describe visual presentation, not
70+ model-quality gates.** Use constructor arguments for color, thickness,
71+ opacity, text, position, style, and generic visualization parameters such as
72+ sigma levels. Annotators may skip invalid geometry defensively, including
73+ missing points, zero-area boxes, non-finite coordinates, or points marked
74+ invisible on the container. They should not introduce confidence thresholds or
75+ model-specific quality gates as rendering options.
76+
4477## How to Contribute Changes
4578
4679First, fork this repository to your own GitHub account. Click "fork" in the top corner of the ` supervision ` repository to get started:
0 commit comments