TAPNext coordinate cross entropy ignores visibility weights after scalar reduction
@sylvesterkaczmarek is already working on this.
Since Oct 9, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python, pytorch
- Domain
- computer-vision, machine-learning, testing
Research direction
Start by reading tapnet/tapnext/torch_losses.py, focusing on coordinate_softmax and how its cross-entropy reductions interact with the visibility mask. Run the prepared regressions comparing against the independent logsumexp/gather calculation and exercising tapnext_loss_and_grad; done means masked points contribute neither coordinate loss nor gradients while both mask shapes remain supported. A linked pull request is already open.
Written by the indexing model from the issue text.
Description
Reproduced on main 730cda1c730877cfedbe01bf87fb1cadb78a565d.
coordinate_softmax uses the default mean reduction in both F.cross_entropy calls before multiplying by the visibility mask. The resulting scalar is broadcast over the mask, so the mask cancels out whenever its sum is nonzero. Occluded points still affect coordinate loss and gradients.
import torch
from tapnet.tapnext import torch_losses
logits = torch.tensor([[[[4., 0., 4., 0.], [0., 4., 0., 4.]]]], requires_grad=True)
labels = torch.full((1, 1, 2, 2), .5)
mask = torch.tensor([[[[1.], [0.]]]])
loss = torch_losses.coordinate_softmax(logits, labels, mask, pixel_size=2)
loss.backward()
print(loss.item(), logits.grad)
Current loss is approximately 4.0363 rather than the visible-point value 0.0363, and the masked point receives nonzero gradients. The public tapnext_loss_and_grad path is also affected.
Use unreduced cross entropy and then apply per-point weights. Preserve support for both plain masks and the trailing singleton axis used by the training helper. Reference for unreduced output: https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.cross_entropy.html
Prepared regressions compare an independent logsumexp/gather calculation and exercise the actual public backward helper with a deterministic tiny tracker. All-zero masks and nonfinite logits are outside this fix.
- Dominant language
- Jupyter Notebook
- Stars
- 2.2k
- Forks
- 215
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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.
More from google-deepmind/tapnet
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
google-deepmind/tapnet#173 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
google-deepmind/tapnet#171 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
google-deepmind/tapnet#166 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
google-deepmind/tapnet#165 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
google-deepmind/tapnet#164 · 3 comments ·
All issues in google-deepmind/tapnet
Similar issues
-
bug multimodal
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
analyze.npq uses F0 instead of Fm on v5.0Possibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
danforthcenter/plantcv#2104 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
:bug: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
scikit-image/scikit-image#8377 · 1 comment ·
Maintainers usually reply within 1 day
-
Affine rejects batch-1 parameters for a batch of images when center is not givenPossibly taken @Debcode2006 claimed this 1 day ago. Openbug :bug: help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
kornia/kornia#6395 · 5 comments ·
Maintainers usually reply within 1 day