ToBBoxes
- class hybrid_learning.datasets.transforms.image_transforms.ToBBoxes(bbox_size, iou_threshold=0.5, batch_wise=False)[source]
Bases:
BatchWiseImageTransform
Treat pixels of given mask as scores of constant-size bounding boxes, and return a mask with the non-max-suppressed bounding boxes.
Public Data Attributes:
The constant size to be assumed for all bounding boxes in pixels.
Settings to reproduce the instance.
Inherited from : py: class:BatchWiseImageTransform
Settings to reproduce the instance.
Inherited from : py: class:Transform
IDENTITY_CLASS
The identity class or classes for composition / addition.
Settings to reproduce the instance.
Public Methods:
apply_to_batch
(score_masks)Bloat the
score_masks
to a mask of non-max-suppressed bounding boxes.Inherited from : py: class:BatchWiseImageTransform
apply_to
(mask)Apply trafo to the mask (either considered as batch of mask or single mask).
apply_to_batch
(score_masks)Bloat the
score_masks
to a mask of non-max-suppressed bounding boxes.Inherited from : py: class:ImageTransform
apply_to
(mask)Apply trafo to the mask (either considered as batch of mask or single mask).
Inherited from : py: class:Transform
apply_to
(mask)Apply trafo to the mask (either considered as batch of mask or single mask).
Special Methods:
__init__
(bbox_size[, iou_threshold, batch_wise])Init.
Inherited from : py: class:BatchWiseImageTransform
__init__
(bbox_size[, iou_threshold, batch_wise])Init.
Inherited from : py: class:ImageTransform
__call__
(img)Application of transformation.
Inherited from : py: class:Transform
__repr__
()Return repr(self).
__eq__
(other)Return self==value.
__copy__
()Return a shallow copy of self using settings.
__add__
(other)Return a flat composition of
self
withother
.__radd__
(other)Return a flat composition of
other
andself
.__call__
(img)Application of transformation.
- apply_to_batch(score_masks)[source]
Bloat the
score_masks
to a mask of non-max-suppressed bounding boxes. Each pixel inscore_masks
should represent the score of a bounding box of fixed size anchored at this pixel. The box size is derived frombbox_size
.score_masks
should be a mask of size(..., height, width)
. For non-max-suppression of the bounding boxes,torchvision.ops.nms()
is used.
- property bbox_size: Tuple[int, int]
The constant size to be assumed for all bounding boxes in pixels. Give as
(height, width)
.
- bloater: BatchBoxBloat
The bloating operation used to create a mask with bounding boxes from anchors and scores.