Skip to content

fix(loss-func): keypoint_2d_loss score tensor not sliced (+1 more) - #49

Draft
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/loss-func-assorted-b77813b4
Draft

fix(loss-func): keypoint_2d_loss score tensor not sliced (+1 more)#49
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/loss-func-assorted-b77813b4

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in global_recon/models/loss_func.py:

fix: keypoint_2d_loss score tensor not sliced with first_frame_only

Fix: Replace:

        if first_frame_only:
            loss = loss[[0]]
            num_pose += vis_frames.sum()
        else:
            num_pose += vis_frames.sum()
        loss[:10] *= first_frame_weight
        loss = (loss.sum(-1) * (score ** 2)).sum()

with:

        if first_frame_only:
            loss = loss[[0]]
            score = score[[0]]
            num_pose += 1
        else:
            num_pose += vis_frames.sum()
        loss[:10] *= first_frame_weight
        loss = (loss.sum(-1) * (score ** 2)).sum()

fix: rel_transform_loss counts invisible frames and bad bool check

Fix: Replace:

    for (i, j), rel_transform_cam in data['rel_transform_cam'].items():
        num_pose += rel_transform_cam.shape[0]
        vis_frames = person_data[i]['vis_frames'] & person_data[j]['vis_frames']
        if sum(vis_frames) == 0:
            continue

with:

    for (i, j), rel_transform_cam in data['rel_transform_cam'].items():
        vis_frames = person_data[i]['vis_frames'] & person_data[j]['vis_frames']
        if vis_frames.sum().item() == 0:
            continue
        num_pose += vis_frames.sum()

Files changed

  • global_recon/models/loss_func.py

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

Successfully merging this pull request may close these issues.

1 participant