torchcv icon indicating copy to clipboard operation
torchcv copied to clipboard

Non Normalized coordinates

Open vaishnavm217 opened this issue 7 years ago • 4 comments

Hi, I am working on face detection using your ssd model. One thing I noticed that my model was giving zero loss, i.e all the ious were zero. After long inspection https://github.com/kuangliu/torchcv/blob/6291f3e1e4bbf6467fd6b1e79001d34a59481bb6/examples/ssd/train.py#L63 this line passes the boxes coordinates as it is. It should be normalized to get correct iou

vaishnavm217 avatar Jun 13 '18 06:06 vaishnavm217

Yeah, i also noticed that you tested the VOC dataset by the image size of 300*300.

tfygg avatar Jun 21 '18 08:06 tfygg

@vaishnavm217 to fix this do we just do something like this? to normalise the bounding boxes.

        w,h = image.size
        boxes /= torch.Tensor([w,h,w,h]).expand_as(boxes)

ljtruong avatar Jul 15 '18 04:07 ljtruong

That's more appropriate. But assuming a square image as input, you can just divide it by any one of the dimension.

On Sun, 15 Jul 2018, 10:22 Leon, [email protected] wrote:

@vaishnavm217 https://github.com/vaishnavm217 to fix this do we just do something like this? to normalise the bounding boxes.

    w,h = image.size
    boxes /= torch.Tensor([w,h,w,h]).expand_as(boxes)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kuangliu/torchcv/issues/30#issuecomment-405067321, or mute the thread https://github.com/notifications/unsubscribe-auth/AQy9UHw_G5TtJTRyZOSs4DGpGYW8B_O4ks5uGsqmgaJpZM4UlnKK .

vaishnavm217 avatar Jul 15 '18 04:07 vaishnavm217

@vaishnavm217 thank you for the confirmation. much appreciated. I'm testing out the train now and it's working well.

Just looking ahead. When I run it through prediction or evaluation, where would the best place to denormalise the labels?.

ljtruong avatar Jul 15 '18 05:07 ljtruong