Haiyang-W / DSVT

[CVPR2023] Official Implementation of "DSVT: Dynamic Sparse Voxel Transformer with Rotated Sets"
https://arxiv.org/abs/2301.06051
Apache License 2.0
353 stars 28 forks source link

A bug in transfusion_head.py code, in case that pc_range is rectangle #73

Open zzwforver opened 3 months ago

zzwforver commented 3 months ago

Hello @chenshi3 When I trained with this project, I found that the training process loss of the model was difficult to converge when pc_range was set to a rectangle. After checking, I in the "OpenPCDet/pcdet/models/dense_heads/transfusion_head py" file found an error. The specific errors in lines 366-369 are as follows:

    center = torch.tensor([coor_x, coor_y], dtype=torch.float32, device=device)
    center_int = center.to(torch.int32)
    # centernet_utils.draw_gaussian_to_heatmap(heatmap[gt_labels_3d[idx]], center_int, radius)
    centernet_utils.draw_gaussian_to_heatmap(heatmap[gt_labels_3d[idx]], center_int[[1,0]], radius)

Line 369 incorrectly sets the x and y coordinate order for center_int. When the pc_range is square, this situation will not produce an error, but when it is rectangular, it will be exposed. The correct code should be line 368 of the comment, why did you comment it out and change it to line 369

Haiyang-W commented 3 months ago

Thanks very much! I'll check this part and fix it as soon as possible. :) Thanks a lot for your contribution. :)

chenshi3 commented 3 months ago

Hello @chenshi3 When I trained with this project, I found that the training process loss of the model was difficult to converge when pc_range was set to a rectangle. After checking, I in the "OpenPCDet/pcdet/models/dense_heads/transfusion_head py" file found an error. The specific errors in lines 366-369 are as follows:

    center = torch.tensor([coor_x, coor_y], dtype=torch.float32, device=device)
    center_int = center.to(torch.int32)
    # centernet_utils.draw_gaussian_to_heatmap(heatmap[gt_labels_3d[idx]], center_int, radius)
    centernet_utils.draw_gaussian_to_heatmap(heatmap[gt_labels_3d[idx]], center_int[[1,0]], radius)

Line 369 incorrectly sets the x and y coordinate order for center_int. When the pc_range is square, this situation will not produce an error, but when it is rectangular, it will be exposed. The correct code should be line 368 of the comment, why did you comment it out and change it to line 369

The xy dimension of feature map should be aligned to center_int.