pixano.features.schemas.annotations.bbox
BBox(created_at=None, updated_at=None, **data)
Bases: Annotation
Bounding box using coordinates in xyxy or xywh format.
Attributes:
Name | Type | Description |
---|---|---|
coords |
list[float]
|
List of coordinates in given format. |
format |
str
|
Coordinates format, 'xyxy' or 'xywh'. |
is_normalized |
bool
|
True if coordinates are normalized to image size. |
confidence |
float
|
Bounding box confidence if predicted. -1 if not predicted. |
Source code in pixano/features/schemas/base_schema.py
xywh_coords
property
xyxy_coords
property
denormalize(height, width)
Return the bounding box with coordinates denormalized relatively to the image size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height
|
int
|
Image height. |
required |
width
|
int
|
Image width. |
required |
Returns:
Type | Description |
---|---|
Self
|
Bounding box with coordinates denormalized relatively to the image size. |
Source code in pixano/features/schemas/annotations/bbox.py
from_mask(mask, **kwargs)
staticmethod
Create a bounding box using a NumPy array mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
ndarray
|
NumPy array mask. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
BBox
|
The bounding box. |
Source code in pixano/features/schemas/annotations/bbox.py
from_rle(rle, **kwargs)
staticmethod
Create a bounding box using a RLE mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rle
|
CompressedRLE
|
RLE mask. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
BBox
|
The bounding box. |
Source code in pixano/features/schemas/annotations/bbox.py
from_xywh(xywh, **kwargs)
staticmethod
Create a bounding box using normalized xywh coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xywh
|
list[float]
|
List of coordinates in xywh format. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
BBox
|
The bounding box. |
Source code in pixano/features/schemas/annotations/bbox.py
from_xyxy(xyxy, **kwargs)
staticmethod
Create a bounding box using normalized xyxy coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xyxy
|
list[float]
|
List of coordinates in xyxy format. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
BBox
|
The bounding box. |
Source code in pixano/features/schemas/annotations/bbox.py
none()
classmethod
Utility function to get a None
equivalent.
Should be removed as soon as Lance manages None
value.
Returns:
Type | Description |
---|---|
Self
|
"None" |
Source code in pixano/features/schemas/annotations/bbox.py
normalize(height, width)
Return the bounding box with coordinates normalized relatively to the image size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height
|
int
|
Image height. |
required |
width
|
int
|
Image width. |
required |
Returns:
Type | Description |
---|---|
Self
|
Bounding box with coordinates normalized relatively to the image size. |
Source code in pixano/features/schemas/annotations/bbox.py
to_xywh()
Return the bounding box in xywh format.
Returns:
Type | Description |
---|---|
Self
|
Bounding box in xyxy format. |
Source code in pixano/features/schemas/annotations/bbox.py
to_xyxy()
Return the bounding box in xyxy format.
Returns:
Type | Description |
---|---|
Self
|
Bounding box in xyxy format. |
Source code in pixano/features/schemas/annotations/bbox.py
BBox3D(created_at=None, updated_at=None, **data)
Bases: Annotation
A 3D bounding Box.
Attributes:
Name | Type | Description |
---|---|---|
coords |
list[float]
|
List of coordinates in given format. |
format |
str
|
Coordinates format, 'xyzxyz' or 'xyzwhd'. |
heading |
list[float]
|
Orientation of the bounding box. |
is_normalized |
bool
|
True if coordinates are normalized to image size. |
confidence |
float
|
Bounding box confidence if predicted. -1 if not predicted. |
Source code in pixano/features/schemas/base_schema.py
none()
classmethod
Utility function to get a None
equivalent.
Should be removed as soon as Lance manages None
value.
Returns:
Type | Description |
---|---|
Self
|
"None" BBox3D. |
Source code in pixano/features/schemas/annotations/bbox.py
create_bbox(coords, format, is_normalized, confidence=-1, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none())
Create a BBox
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coords
|
list[float]
|
List of coordinates in given format. |
required |
format
|
Literal['xyxy', 'xywh']
|
Coordinates format, 'xyxy' or 'xywh'. |
required |
is_normalized
|
bool
|
True if coordinates are normalized to image size. |
required |
confidence
|
float
|
Bounding box confidence if predicted. |
-1
|
id
|
str
|
BBox ID. |
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
Returns:
Type | Description |
---|---|
BBox
|
The created |
Source code in pixano/features/schemas/annotations/bbox.py
create_bbox3d(coords, format, heading, is_normalized, confidence=-1.0, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none())
Create a BBox3D
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coords
|
list[float]
|
The 3D position coordinates. |
required |
format
|
Literal['xyzxyz', 'xyzwhd']
|
Coordinates format, 'xyzxyz' or 'xyzwhd'. |
required |
heading
|
list[float]
|
The orientation. |
required |
is_normalized
|
bool
|
True if coordinates are normalized to image size. |
required |
confidence
|
float
|
Bounding box confidence if predicted. |
-1.0
|
id
|
str
|
BBox3D ID. |
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
Returns:
Type | Description |
---|---|
BBox3D
|
The created |