Open donguklim opened 2 years ago
The maximum possible distance is calculated with resized image size.
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L143
But this should be calculated with the original image size, as bellow code also calculates distances in the original image.
Bellow two lines need to be changed
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L224
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L204
Suggested change
max_dist = (orig_size_b **2).sum().sqrt() .... # Corner case: no GT points if gt_b.ndimension() == 1 and (gt_b < 0).all().item() == 0: terms_1.append(torch.tensor([0], dtype=torch.get_default_dtype())) terms_2.append(torch.tensor([max_dist], dtype=torch.get_default_dtype())) continue ..... weighted_d_matrix = (1 - p_replicated)*max_dist + p_replicated*d_matrix
I am sorry, too lazy to make pull request to fix it by myself now.
The maximum possible distance is calculated with resized image size.
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L143
But this should be calculated with the original image size, as bellow code also calculates distances in the original image.
Bellow two lines need to be changed
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L224
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L204
Suggested change
I am sorry, too lazy to make pull request to fix it by myself now.