We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
torchcv/torchcv/utils/box.py
Line 128 in 6291f3e
overlap
ids
>>> (torch.Tensor([0.1, 0.2, 0.6]) < 0.45).nonzero().squeeze() tensor([0, 1]) >>> (torch.Tensor([0.1]) < 0.45).nonzero().squeeze() tensor(0) >>> (torch.Tensor([0.6]) < 0.45).nonzero().squeeze() tensor([], dtype=torch.int64)
The text was updated successfully, but these errors were encountered:
It's when (overlap<=threshold).nonzero() contains only 1 element, more accurately.
(overlap<=threshold).nonzero()
And adding dim=1 will fix it: ids = (overlap<=threshold).nonzero().squeeze(dim=1)
dim=1
ids = (overlap<=threshold).nonzero().squeeze(dim=1)
Examples:
>>> (torch.Tensor([0.6, 0.1, 0.2]) < 0.45).nonzero().squeeze(dim=1) tensor([1, 2]) >>> (torch.Tensor([0.1, 0.6]) < 0.45).nonzero().squeeze(dim=1) tensor([0]) >>> (torch.Tensor([0.6, 0.1]) < 0.45).nonzero().squeeze(dim=1) tensor([1]) >>> (torch.Tensor([0.1]) < 0.45).nonzero().squeeze(dim=1) tensor([0])
Sorry, something went wrong.
No branches or pull requests
torchcv/torchcv/utils/box.py
Line 128 in 6291f3e
When
overlap
contains only 1 element,ids
will be a 0-dimensional tensor, which will cause dimension mismatch later.Examples:
The text was updated successfully, but these errors were encountered: