Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancescoSaverioZuppichini/100e480efcd1085fe9587a4759d6a673 to your computer and use it in GitHub Desktop.
Save FrancescoSaverioZuppichini/100e480efcd1085fe9587a4759d6a673 to your computer and use it in GitHub Desktop.
Test
max_bboxes = 3
scaling = torch.tensor([1, .96, .97, 1.02])
shifting = torch.tensor([0, 0.001, 0.002, -0.002])
# broadcasting magic (2, 1, 4) * (1, 3, 1)
bboxes = (original_bboxes[:,None,:] * scaling[..., None] + shifting[..., None]).view(-1, 4)
plot_bboxes(img, bboxes, colors=[*["yellow"] * 4, *["blue"] * 4], labels=[*["head"] * 4, *["mic"] * 4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment