Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about Bbox class and methods #35

Open
kichoul64 opened this issue Sep 29, 2021 · 0 comments
Open

Questions about Bbox class and methods #35

kichoul64 opened this issue Sep 29, 2021 · 0 comments

Comments

@kichoul64
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant