# subbu6699/supervision architecture

> Architecture diagram of the GitHub repository subbu6699/supervision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subbu6699/supervision
- Repository: https://github.com/subbu6699/supervision

## Overview

Supervision is a model-agnostic Python computer-vision toolkit: users supply model outputs or datasets, normalize predictions into shared structures, then analyze, visualize, and evaluate them. The README documents model connectors, annotation, and dataset load/split/merge/save workflows; the tree adds zones, inference slicing, keypoints, and metrics. Sampled source confirms the shared detection representation, slicing callback, annotators, dataset core, and evaluation metrics. Other links reflect documented capabilities; unsampled implementation wiring is not inferred.

Main entry points: [`src/supervision/detection/core.py`](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/core.py) (Detection structure), [`src/supervision/metrics/detection.py`](https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/detection.py) (Detection metrics), [`src/supervision/detection/tools/inference_slicer.py`](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/inference_slicer.py) (Inference slicing), [`src/supervision/annotators/core.py`](https://github.com/subbu6699/supervision/blob/develop/src/supervision/annotators/core.py) (Frame annotators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interop["Model Interop"]
  node_image["Image and video I/O<br/>[image.py]"]
  node_video["Video capture<br/>[_video.py]"]
  node_detections["Detection structure<br/>[core.py]"]
  node_classification["Classification structure<br/>[core.py]"]
  node_keypoints["Keypoint structure<br/>[core.py]"]
end

subgraph group_analysis["Vision Analysis"]
  node_slicer["Inference slicing"]
  node_geometry["Geometry operations<br/>[core.py]"]
  node_zones["Zone analysis<br/>[polygon_zone.py]"]
  node_linezone["Line counting<br/>[line_zone.py]"]
  node_smoother["Detection smoothing<br/>[smoother.py]"]
  node_transformers["Detection transforms<br/>[transformers.py]"]
end

subgraph group_visual["Visualization"]
  node_annotators["Frame annotators<br/>[core.py]"]
  node_keypointannotators["Pose annotators<br/>[annotators.py]"]
  node_draw["Drawing primitives<br/>[base.py]"]
end

subgraph group_data["Dataset Workflows"]
  node_dataset["Dataset operations<br/>[core.py]"]
  node_formats["Dataset formats"]
  node_sinks["Detection exports<br/>[csv_sink.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Detection metrics<br/>[detection.py]"]
  node_map["Mean average precision"]
  node_mar["Mean average recall"]
end

node_user(("Application developer"))
node_model(("Vision model"))

node_user -->|"loads media"| node_image
node_user -->|"runs inference"| node_model
node_model -->|"normalizes output"| node_detections
node_model -.->|"provides results"| node_classification
node_model -.->|"provides poses"| node_keypoints
node_image -->|"supplies image"| node_slicer
node_slicer -->|"calls callback"| node_model
node_detections -->|"slice results"| node_slicer
node_user -->|"analyzes detections"| node_zones
node_user -->|"counts crossings"| node_linezone
node_user -->|"smooths detections"| node_smoother
node_user -->|"transforms detections"| node_transformers
node_user -->|"annotates frame"| node_annotators
node_detections -->|"provides predictions"| node_annotators
node_annotators -->|"uses primitives"| node_draw
node_keypoints -->|"provides pose data"| node_keypointannotators
node_user -->|"loads or edits data"| node_dataset
node_formats -->|"reads and writes formats"| node_dataset
node_detections -->|"supplies annotations"| node_dataset
node_user -->|"evaluates predictions"| node_metrics
node_metrics -->|"computes mAP"| node_map
node_metrics -->|"computes mAR"| node_mar
node_detections -->|"provides predictions"| node_metrics
node_user -->|"exports results"| node_sinks
node_sinks -->|"serializes detections"| node_detections

click node_image "https://github.com/subbu6699/supervision/blob/develop/src/supervision/utils/image.py"
click node_video "https://github.com/subbu6699/supervision/blob/develop/src/supervision/_cv2/_video.py"
click node_detections "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/core.py"
click node_classification "https://github.com/subbu6699/supervision/blob/develop/src/supervision/classification/core.py"
click node_keypoints "https://github.com/subbu6699/supervision/blob/develop/src/supervision/key_points/core.py"
click node_slicer "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/inference_slicer.py"
click node_geometry "https://github.com/subbu6699/supervision/blob/develop/src/supervision/geometry/core.py"
click node_zones "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/polygon_zone.py"
click node_linezone "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/line_zone.py"
click node_smoother "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/smoother.py"
click node_transformers "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/transformers.py"
click node_annotators "https://github.com/subbu6699/supervision/blob/develop/src/supervision/annotators/core.py"
click node_keypointannotators "https://github.com/subbu6699/supervision/blob/develop/src/supervision/key_points/annotators.py"
click node_draw "https://github.com/subbu6699/supervision/blob/develop/src/supervision/draw/base.py"
click node_dataset "https://github.com/subbu6699/supervision/blob/develop/src/supervision/dataset/core.py"
click node_formats "https://github.com/subbu6699/supervision/tree/develop/src/supervision/dataset/formats"
click node_metrics "https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/detection.py"
click node_map "https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/mean_average_precision.py"
click node_mar "https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/mean_average_recall.py"
click node_sinks "https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/csv_sink.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_image,node_video,node_detections,node_classification,node_keypoints toneBlue
class node_slicer,node_geometry,node_zones,node_linezone,node_smoother,node_transformers toneAmber
class node_annotators,node_keypointannotators,node_draw toneMint
class node_dataset,node_formats,node_sinks toneRose
class node_metrics,node_map,node_mar,node_user,node_model toneIndigo
```

## Components

### Model Interop

- [Image and video I/O](https://github.com/subbu6699/supervision/blob/develop/src/supervision/utils/image.py): `src/supervision/utils/image.py`
- [Video capture](https://github.com/subbu6699/supervision/blob/develop/src/supervision/_cv2/_video.py): `src/supervision/_cv2/_video.py`
- [Detection structure](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/core.py): `src/supervision/detection/core.py`
- [Classification structure](https://github.com/subbu6699/supervision/blob/develop/src/supervision/classification/core.py): `src/supervision/classification/core.py`
- [Keypoint structure](https://github.com/subbu6699/supervision/blob/develop/src/supervision/key_points/core.py): `src/supervision/key_points/core.py`

### Vision Analysis

- [Inference slicing](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/inference_slicer.py): `src/supervision/detection/tools/inference_slicer.py`
- [Geometry operations](https://github.com/subbu6699/supervision/blob/develop/src/supervision/geometry/core.py): `src/supervision/geometry/core.py`
- [Zone analysis](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/polygon_zone.py): `src/supervision/detection/tools/polygon_zone.py`
- [Line counting](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/line_zone.py): `src/supervision/detection/line_zone.py`
- [Detection smoothing](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/smoother.py): `src/supervision/detection/tools/smoother.py`
- [Detection transforms](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/transformers.py): `src/supervision/detection/tools/transformers.py`

### Visualization

- [Frame annotators](https://github.com/subbu6699/supervision/blob/develop/src/supervision/annotators/core.py): `src/supervision/annotators/core.py`
- [Pose annotators](https://github.com/subbu6699/supervision/blob/develop/src/supervision/key_points/annotators.py): `src/supervision/key_points/annotators.py`
- [Drawing primitives](https://github.com/subbu6699/supervision/blob/develop/src/supervision/draw/base.py): `src/supervision/draw/base.py`

### Dataset Workflows

- [Dataset operations](https://github.com/subbu6699/supervision/blob/develop/src/supervision/dataset/core.py): `src/supervision/dataset/core.py`
- [Dataset formats](https://github.com/subbu6699/supervision/tree/develop/src/supervision/dataset/formats): `src/supervision/dataset/formats`
- [Detection exports](https://github.com/subbu6699/supervision/blob/develop/src/supervision/detection/tools/csv_sink.py): `src/supervision/detection/tools/csv_sink.py`

### Evaluation

- [Detection metrics](https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/detection.py): `src/supervision/metrics/detection.py`
- [Mean average precision](https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/mean_average_precision.py): `src/supervision/metrics/mean_average_precision.py`
- [Mean average recall](https://github.com/subbu6699/supervision/blob/develop/src/supervision/metrics/mean_average_recall.py): `src/supervision/metrics/mean_average_recall.py`

### Other components

- **Application developer**
- **Vision model**

## Connections

- Application developer → Image and video I/O: loads media
- Application developer → Vision model: runs inference
- Vision model → Detection structure: normalizes output
- Vision model → Classification structure: provides results
- Vision model → Keypoint structure: provides poses
- Image and video I/O → Inference slicing: supplies image
- Inference slicing → Vision model: calls callback
- Detection structure → Inference slicing: slice results
- Application developer → Zone analysis: analyzes detections
- Application developer → Line counting: counts crossings
- Application developer → Detection smoothing: smooths detections
- Application developer → Detection transforms: transforms detections
- Application developer → Frame annotators: annotates frame
- Detection structure → Frame annotators: provides predictions
- Frame annotators → Drawing primitives: uses primitives
- Keypoint structure → Pose annotators: provides pose data
- Application developer → Dataset operations: loads or edits data
- Dataset formats → Dataset operations: reads and writes formats
- Detection structure → Dataset operations: supplies annotations
- Application developer → Detection metrics: evaluates predictions
- Detection metrics → Mean average precision: computes mAP
- Detection metrics → Mean average recall: computes mAR
- Detection structure → Detection metrics: provides predictions
- Application developer → Detection exports: exports results
- Detection exports → Detection structure: serializes detections
