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

关于loss的疑问 #20

Open
Sunway-s opened this issue May 4, 2024 · 3 comments
Open

关于loss的疑问 #20

Sunway-s opened this issue May 4, 2024 · 3 comments

Comments

@Sunway-s
Copy link

Sunway-s commented May 4, 2024

对于SparseOcc/models/loss_utils.py中291行的 loss_classes 计算我有一些疑惑

tgt_class = class_gt[b]
tgt_mask = (tgt_mask.unsqueeze(-1) == torch.arange(num_instances).to(mask_gt.device))
tgt_mask = tgt_mask.permute(1, 0)
            
src_idx, tgt_idx = indices[b]
src_mask = mask_pred[b][src_idx]   # [M, N], M is number of gt instances, N is number of remaining voxels
tgt_mask = tgt_mask[tgt_idx]   # [M, N]
src_class = class_pred[b]   # [Q, CLS]
            
# pad non-aligned queries' tgt classes with 'no class'
pad_tgt_class = torch.full(
       (src_class.shape[0], ), self.num_classes - 1, dtype=torch.int64, device=class_pred.device
)   # [Q]
pad_tgt_class[src_idx] = tgt_class

为什么这里的 tgt_class 不用加 tgt_class[tgt_idx] 呢,而是直接 tgt_class = class_gt[b]

@afterthat97
Copy link
Collaborator

Sorry for the late reply. It is a BUG. We retrained the model but it doesn't seem to affect the performance. We are working to find out the reason. Thank you very very much!

@afterthat97
Copy link
Collaborator

We investigated this bug and found that it only affects the initial stage of class loss. In the later stage, tgt_idx is mostly ordered, so it has little impact on the final performance.

Class loss:

image

RayIoU:

image

@afterthat97
Copy link
Collaborator

Thank you so much for reading our code so carefully!

afterthat97 pushed a commit that referenced this issue May 29, 2024
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

2 participants