base_bbox_coder.py 776 B

1234567891011121314151617181920212223242526
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. from abc import ABCMeta, abstractmethod
  3. class BaseBBoxCoder(metaclass=ABCMeta):
  4. """Base bounding box coder.
  5. Args:
  6. use_box_type (bool): Whether to warp decoded boxes with the
  7. box type data structure. Defaults to False.
  8. """
  9. # The size of the last of dimension of the encoded tensor.
  10. encode_size = 4
  11. def __init__(self, use_box_type: bool = False, **kwargs):
  12. self.use_box_type = use_box_type
  13. @abstractmethod
  14. def encode(self, bboxes, gt_bboxes):
  15. """Encode deltas between bboxes and ground truth boxes."""
  16. @abstractmethod
  17. def decode(self, bboxes, bboxes_pred):
  18. """Decode the predicted bboxes according to prediction and base
  19. boxes."""