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

RuntimeError in: mmdet/core/anchor/anchor_target.py #15

Closed
Randomless opened this issue Apr 16, 2021 · 2 comments
Closed

RuntimeError in: mmdet/core/anchor/anchor_target.py #15

Randomless opened this issue Apr 16, 2021 · 2 comments

Comments

@Randomless
Copy link

Randomless commented Apr 16, 2021

RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2

in: mmdet/core/anchor/anchor_target.py

def anchor_inside_flags(flat_anchors, valid_flags, img_shape,
                        allowed_border=0):
    img_h, img_w = img_shape[:2]
    allowed_border=-1
    if allowed_border >= 0:
        inside_flags = valid_flags & \
            (flat_anchors[:, 0] >= -allowed_border) & \
            (flat_anchors[:, 1] >= -allowed_border) & \
            (flat_anchors[:, 2] < img_w + allowed_border) & \
            (flat_anchors[:, 3] < img_h + allowed_border)
    else:
        inside_flags = valid_flags
    return inside_flags
@csuhan
Copy link
Owner

csuhan commented Apr 16, 2021

@zf020114
Copy link

if allowed_border >= 0:
    inside_flags = valid_flags & \
                   (flat_anchors[:, 0] >= -allowed_border).type(torch.uint8) & \
                   (flat_anchors[:, 1] >= -allowed_border).type(torch.uint8) & \
                   (flat_anchors[:, 2] < img_w + allowed_border).type(torch.uint8) & \
                   (flat_anchors[:, 3] < img_h + allowed_border).type(torch.uint8)

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

3 participants