Discussion about the paper of name CenterNet

Hello everyone!
Currently I’ve started reading the paper of name “CenterNet: Objects as Points”. The general idea is to train a keypoint estimator using heat-map and then extend those detected keypoint to other task such as object detection, human-pose estimation, etc. But the thing that confused me is how to splat the ground truth keypoint onto a heat-map by using Gaussian kernel.

What is object size-adaptive standard deviation? How to calculate the sigma for that formula.
Best regards!

From [30 - Hei Law, Jia Deng: CornerNet: Detecting Objects as Paired Keypoints]:

So the reference without comment how they do something different would seem to indicate that they do something very similar, i.e. I expect them to see how much you can move the bounding box (keeping the size the same, if they only consider the center, I guess) while keeping IoU >= 0.7. Without some thought, I wouldn’t know whether axial or some diagonal translation is crucial, but you could experiment with that. This would be the radius. Then you could take 1/3 like in the reference or so.
Whether that is exactly what they do, I don’t know. However, I would expect to get radii that look somewhat similar to the ones pictured.

Best regards

Thomas

Thanks for you quick reply!
Thomas I checked the code of the CornerNet and it used a formula called unormalized gaussian2d, I googled but didn’t find out the result. Do you know where to derive that formula?

The formula is just the one you have above for Y_xyc, no?

1 Like

Dear Thomas!
I tried that formula but it outputs zero?


It’s that anything I missing?
Best Regards!

def gaussian_radius(det_size, min_overlap=0.7):
    height, width = det_size

    a1 = 1
    b1 = (height + width)
    c1 = width * height * (1 - min_overlap) / (1 + min_overlap)
    sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)
    r1 = (b1 + sq1) / 2

    a2 = 4
    b2 = 2 * (height + width)
    c2 = (1 - min_overlap) * width * height
    sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)
    r2 = (b2 + sq2) / 2

    a3 = 4 * min_overlap
    b3 = -2 * min_overlap * (height + width)
    c3 = (min_overlap - 1) * width * height
    sq3 = np.sqrt(b3 ** 2 - 4 * a3 * c3)
    r3 = (b3 + sq3) / 2
    return min(r1, r2, r3)

def draw_gaussian(heatmap, center, radius, k=1):
    diameter = 2 * radius + 1
    gaussian = gaussian2D((diameter, diameter), sigma=diameter / 6)

    x, y = int(center[0]), int(center[1])

    height, width = heatmap.shape[0:2]

    left, right = min(x, radius), min(width - x, radius + 1)
    top, bottom = min(y, radius), min(height - y, radius + 1)

    masked_heatmap = heatmap[y - top:y + bottom, x - left:x + right]
    masked_gaussian = gaussian[radius - top:radius + bottom, radius - left:radius + right]
    if min(masked_gaussian.shape) > 0 and min(masked_heatmap.shape) > 0:  # TODO debug
        np.maximum(masked_heatmap, masked_gaussian * k, out=masked_heatmap)
    return heatmap

here is official code count sigma