otx.data#
Dataclasses for data entities.
Classes
|
Torch data item batch implementation. |
|
OTX data item implementation. |
|
Torch prediction data item batch implementation. |
|
Torch prediction data item implementation. |
- class otx.data.OTXDataBatch(batch_size: int, images: torch.Tensor | list[torch.Tensor], labels: list[torch.Tensor] | None = None, masks: list[Mask] | None = None, bboxes: list[BoundingBoxes] | None = None, keypoints: list[torch.Tensor] | None = None, polygons: list[list[Polygon]] | None = None, imgs_info: Sequence[ImageInfo | None] | None = None)[source]#
Bases:
ValidateBatchMixin
Torch data item batch implementation.
- pin_memory() OTXDataBatch [source]#
Pin memory for member tensor variables.
- wrap(**kwargs) OTXDataBatch [source]#
Wrap this dataclass with the given keyword arguments.
- Parameters:
**kwargs – Keyword arguments to be overwritten on top of this dataclass
- Returns:
Updated dataclass
- class otx.data.OTXDataItem(image: torch.Tensor | np.ndarray, label: torch.Tensor | None = None, masks: Mask | None = None, bboxes: BoundingBoxes | None = None, keypoints: torch.Tensor | None = None, polygons: list[Polygon] | None = None, img_info: ImageInfo | None = None)[source]#
Bases:
ValidateItemMixin
,Mapping
OTX data item implementation.
- image#
The image tensor
- Type:
torch.Tensor | np.ndarray
- label#
The label tensor, optional.
- Type:
torch.Tensor | None
- masks#
The masks, optional.
- Type:
Mask | None
- bboxes#
The bounding boxes, optional.
- Type:
BoundingBoxes | None
- keypoints#
The keypoints, optional.
- Type:
torch.Tensor | None
- img_info#
Additional image information, optional.
- Type:
ImageInfo | None
- static collate_fn(items: list[OTXDataItem]) OTXDataBatch [source]#
Collate TorchDataItems into a batch.
- Parameters:
items – List of TorchDataItems to batch
- Returns:
Batched TorchDataItems with stacked tensors
- to_tv_image() OTXDataItem [source]#
Return a new instance with the image attribute converted to a TorchVision Image if it is a NumPy array.
- Returns:
A new instance with the image attribute converted to a TorchVision Image, if applicable. Otherwise, return this instance as is.
- wrap(**kwargs) OTXDataItem [source]#
Wrap this dataclass with the given keyword arguments.
- Parameters:
**kwargs – Keyword arguments to be overwritten on top of this dataclass
- Returns:
Updated dataclass
- class otx.data.OTXPredBatch(batch_size: int, images: torch.Tensor | list[torch.Tensor], labels: list[torch.Tensor] | None = None, masks: list[Mask] | None = None, bboxes: list[BoundingBoxes] | None = None, keypoints: list[torch.Tensor] | None = None, polygons: list[list[Polygon]] | None = None, imgs_info: Sequence[ImageInfo | None] | None = None, scores: list[torch.Tensor] | None = None, feature_vector: list[torch.Tensor] | None = None, saliency_map: list[torch.Tensor] | None = None)[source]#
Bases:
OTXDataBatch
Torch prediction data item batch implementation.
- class otx.data.OTXPredItem(image: torch.Tensor | np.ndarray, label: torch.Tensor | None = None, masks: Mask | None = None, bboxes: BoundingBoxes | None = None, keypoints: torch.Tensor | None = None, polygons: list[Polygon] | None = None, img_info: ImageInfo | None = None, scores: torch.Tensor | None = None, feature_vector: torch.Tensor | None = None, saliency_map: torch.Tensor | None = None)[source]#
Bases:
OTXDataItem
Torch prediction data item implementation.