Bounding Box View Model
app.domain.views.bounding_box_view_modelModule for bounding box view model; defines application concepts without UI or infrastructure dependencies.
See Also
Box— domain geometry represented by the view modelDetectionResult— detection output converted to this view model
Layer: Domain. Context: Defines application concepts without ui or infrastructure dependencies at this architectural boundary.
BBoxViewModel
dataclass
Bounding detection display model — binds detection/tracking/manual detection to UI table row.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Display ID, such as
TYPE:
|
source |
Origin, e.g.
TYPE:
|
label |
Class name, such as
TYPE:
|
bbox_xyxy |
Coordinates
TYPE:
|
color_hex |
Display color in
TYPE:
|
confidence |
Score from 0.0 to 1.0, or
TYPE:
|
key |
Unique key for selection and editing.
TYPE:
|
detection_backed |
Whether the tracker observed a detection on this frame.
TYPE:
|
time_since_update |
Number of consecutive frames since a detection matched.
TYPE:
|
Note
Stored in SessionDataStore and displayed in the UI table for the
current frame. confidence_txt and bbox_txt expose formatted
display values, and clone() provides a fast shallow copy.
Layer: Domain. Context: Represents application concepts without UI or infrastructure dependencies.
bbox_txt: str
property
Format box coordinates for display.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Coordinate string in |
bbox_xyxy: BBoxXYXYTuple
instance-attribute
color_hex: str
instance-attribute
confidence: float
instance-attribute
confidence_txt: str
property
Format confidence for display in the annotation table.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Confidence rounded to two decimal places, or |
detection_backed: bool = True
class-attribute
instance-attribute
id: str
instance-attribute
is_detection: bool
property
Return whether the box originated from detection.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
is_manual: bool
property
Return whether the box was created manually.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
key: str = ''
class-attribute
instance-attribute
label: str
instance-attribute
source: BoxSource
instance-attribute
time_since_update: int = 0
class-attribute
instance-attribute
__init__(id: str, source: BoxSource, label: str, bbox_xyxy: BBoxXYXYTuple, color_hex: str, confidence: float, key: str = '', detection_backed: bool = True, time_since_update: int = 0) -> None
clone() -> 'BBoxViewModel'
Create an independent shallow copy of this bounding box.
| RETURNS | DESCRIPTION |
|---|---|
'BBoxViewModel'
|
A box with identical identity, geometry, and tracking observation metadata. |
Note
The tuple geometry and scalar metadata are immutable values and are copied by assignment; later field replacement does not affect the original.
Example
editable = box.clone()