dsntnn
dsntnn copied to clipboard
how to get the confidence score from the output result?
If i use your module to predict keypoint , the output heatmap is not same as the other method, which i means the peak value is soo small . so do u know how to get a resonable confidence score ?
I have not done this myself, but you could try to derive a confidence score from the normalised heatmap by quantifying how "spread out" it is.
I have done something like that if I understand the question correctly. I am computing the variance over the heatmap to determine how confident it is:
def heatmap_variance(heatmaps):
# copied and modified:
# https://github.com/anibali/dsntnn/blob/4f20f5a85b56d007adef51e5158f5a6dca92794f/dsntnn/__init__.py#L233-L262
# mu = E[X]
values = [normalized_linspace(d, dtype=heatmaps.dtype, device=heatmaps.device) for d in heatmaps.size()[2:]]
mu = linear_expectation(heatmaps, values)
# var = E[(X - mu)^2]
values = [(a - b.squeeze(0)) ** 2 for a, b in zip(values, mu.split(1, -1))]
var = linear_expectation(heatmaps, values)
heatmap_size = torch.tensor(list(heatmaps.size()[2:]), dtype=var.dtype, device=var.device)
return var * (heatmap_size / 2) ** 2