easy-faster-rcnn.pytorch icon indicating copy to clipboard operation
easy-faster-rcnn.pytorch copied to clipboard

Questions about Bbox class and methods

Open kichoul64 opened this issue 4 years ago • 0 comments

Hi potterhsu. I'm studying deep learning detection with your code. It helps a lot. really thank you

I'm trying to train with custom data and to insert some 'spatial transform networks' things. Then I'm curious what exactly methods in class BBox is working for. Especially 'calc_transformer' and 'apply_transformer' Are they related to affine transform? or others?. Can i get some explains what they are?

I'm not sure this question is okay in 'Issues', but i don't know elsewhere to ask to you. Sorry for if i make some mistake. I will wait your answer. Thank U

@staticmethod def from_center_base(center_based_bboxes: Tensor) -> Tensor: return torch.stack([ center_based_bboxes[..., 0] - center_based_bboxes[..., 2] / 2, center_based_bboxes[..., 1] - center_based_bboxes[..., 3] / 2, center_based_bboxes[..., 0] + center_based_bboxes[..., 2] / 2, center_based_bboxes[..., 1] + center_based_bboxes[..., 3] / 2 ], dim=-1)

@staticmethod
def calc_transformer(src_bboxes: Tensor, dst_bboxes: Tensor) -> Tensor:
    center_based_src_bboxes = BBox.to_center_base(src_bboxes)
    center_based_dst_bboxes = BBox.to_center_base(dst_bboxes)
    transformers = torch.stack([
        (center_based_dst_bboxes[..., 0] - center_based_src_bboxes[..., 0]) / center_based_src_bboxes[..., 2],
        (center_based_dst_bboxes[..., 1] - center_based_src_bboxes[..., 1]) / center_based_src_bboxes[..., 3],
        torch.log(center_based_dst_bboxes[..., 2] / center_based_src_bboxes[..., 2]),
        torch.log(center_based_dst_bboxes[..., 3] / center_based_src_bboxes[..., 3])
    ], dim=-1)
    return transformers

kichoul64 avatar Sep 29 '21 15:09 kichoul64