Skip to content

Commit

Permalink
fix: move kpts mAP output to correct device
Browse files Browse the repository at this point in the history
  • Loading branch information
JSabadin committed Dec 16, 2024
1 parent 6445cbf commit 0c45b8c
Showing 1 changed file with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,36 @@ def compute(self) -> tuple[Tensor, dict[str, Tensor]]:
self.coco_eval.summarize()
stats = self.coco_eval.stats

kpt_map = torch.tensor([stats[0]], dtype=torch.float32)
device = self.pred_keypoints[0].device
kpt_map = torch.tensor([stats[0]], dtype=torch.float32, device=device)
return kpt_map, {
"kpt_map_50": torch.tensor([stats[1]], dtype=torch.float32),
"kpt_map_75": torch.tensor([stats[2]], dtype=torch.float32),
"kpt_map_medium": torch.tensor([stats[3]], dtype=torch.float32),
"kpt_map_large": torch.tensor([stats[4]], dtype=torch.float32),
"kpt_mar": torch.tensor([stats[5]], dtype=torch.float32),
"kpt_mar_50": torch.tensor([stats[6]], dtype=torch.float32),
"kpt_mar_75": torch.tensor([stats[7]], dtype=torch.float32),
"kpt_mar_medium": torch.tensor([stats[8]], dtype=torch.float32),
"kpt_mar_large": torch.tensor([stats[9]], dtype=torch.float32),
"kpt_map_50": torch.tensor(
[stats[1]], dtype=torch.float32, device=device
),
"kpt_map_75": torch.tensor(
[stats[2]], dtype=torch.float32, device=device
),
"kpt_map_medium": torch.tensor(
[stats[3]], dtype=torch.float32, device=device
),
"kpt_map_large": torch.tensor(
[stats[4]], dtype=torch.float32, device=device
),
"kpt_mar": torch.tensor(
[stats[5]], dtype=torch.float32, device=device
),
"kpt_mar_50": torch.tensor(
[stats[6]], dtype=torch.float32, device=device
),
"kpt_mar_75": torch.tensor(
[stats[7]], dtype=torch.float32, device=device
),
"kpt_mar_medium": torch.tensor(
[stats[8]], dtype=torch.float32, device=device
),
"kpt_mar_large": torch.tensor(
[stats[9]], dtype=torch.float32, device=device
),
}

def _get_coco_format(
Expand Down

0 comments on commit 0c45b8c

Please sign in to comment.