Skip to content

Commit

Permalink
clamp kpts values
Browse files Browse the repository at this point in the history
  • Loading branch information
JSabadin committed Nov 19, 2024
1 parent 093feec commit 4c61f38
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def draw_predictions(
prediction = predictions[i]
mask = prediction[..., 2] < visibility_threshold
visible_kpts = prediction[..., :2] * (~mask).unsqueeze(-1).float()
visible_kpts[..., 0] = torch.clamp(
visible_kpts[..., 0], 0, canvas.size(-1) - 1
)
visible_kpts[..., 1] = torch.clamp(
visible_kpts[..., 1], 0, canvas.size(-2) - 1
)
viz[i] = draw_keypoints(
canvas[i].clone(),
visible_kpts[..., :2],
Expand Down

0 comments on commit 4c61f38

Please sign in to comment.