关于loss的疑问
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 443
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
对于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]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to SparseOcc/models/loss_utils.py around line 291. Start by tracing class_gt, indices, and tgt_idx into the loss_classes calculation and checking their shapes and ordering. Done means the intended indexing behavior is explained in the issue or the implementation is corrected if the ordering is inconsistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100