Spaces:
Running on Zero
Running on Zero
Download mmdet/models/task_modules/coders/base_bbox_coder.py from hugging-apps/levirdetnet: direct link, hf CLI and curl.
- Browser
- Download file 776 Bytes
-
https://huggingface.co/spaces/hugging-apps/levirdetnet/resolve/main/mmdet/models/task_modules/coders/base_bbox_coder.py
- Command line
-
hf download hf://spaces/hugging-apps/levirdetnet/mmdet/models/task_modules/coders/base_bbox_coder.py
-
curl -L -o base_bbox_coder.py https://huggingface.co/spaces/hugging-apps/levirdetnet/resolve/main/mmdet/models/task_modules/coders/base_bbox_coder.py
776 Bytes
| # Copyright (c) OpenMMLab. All rights reserved. | |
| from abc import ABCMeta, abstractmethod | |
| class BaseBBoxCoder(metaclass=ABCMeta): | |
| """Base bounding box coder. | |
| Args: | |
| use_box_type (bool): Whether to warp decoded boxes with the | |
| box type data structure. Defaults to False. | |
| """ | |
| # The size of the last of dimension of the encoded tensor. | |
| encode_size = 4 | |
| def __init__(self, use_box_type: bool = False, **kwargs): | |
| self.use_box_type = use_box_type | |
| def encode(self, bboxes, gt_bboxes): | |
| """Encode deltas between bboxes and ground truth boxes.""" | |
| def decode(self, bboxes, bboxes_pred): | |
| """Decode the predicted bboxes according to prediction and base | |
| boxes.""" | |