hollance / BlazeFace-PyTorch

The BlazeFace face detector model implemented in PyTorch
Other
429 stars 91 forks source link

Max vs Min issue #6

Closed nlothian closed 4 years ago

nlothian commented 4 years ago

Thanks very much for making this available.

I've been reading the code, and I think there might be a typo here: https://github.com/hollance/BlazeFace-PyTorch/blob/master/blazeface.py#L370

    max_xy = torch.min(box_a[:, 2:].unsqueeze(1).expand(A, B, 2),
                       box_b[:, 2:].unsqueeze(0).expand(A, B, 2))
    min_xy = torch.max(box_a[:, :2].unsqueeze(1).expand(A, B, 2),
                       box_b[:, :2].unsqueeze(0).expand(A, B, 2))

max_xy and min_xy are just reversed, right? Or am I missing something much smarter than me?

I don't think it affects anything either way though?

hollance commented 4 years ago

I don't think it's wrong, it just has a confusing name. ;-) The max that we're looking at is the smallest of the two right/bottom edges. And the min that we're looking at is the largest of the two left/top edges. We're looking for the intersection of the two boxes, not the union.

nlothian commented 4 years ago

Yeah ok - it's the smallest maximum. That makes sense.

Thanks for the response.