def find_instance_center(ctr_hmp, threshold=0.1, nms_kernel=3, top_k=None):
    """
    Find the center points from the center heatmap.

    Args:
        ctr_hmp (Tensor): A Tensor of shape [1, H, W] of raw center heatmap output.
        threshold (float, optional): Threshold applied to center heatmap score. Default: 0.1.
        nms_kernel (int, optional): NMS max pooling kernel size. Default: 3.
        top_k (int, optional): An Integer, top k centers to keep. Default: None

    Returns:
        Tensor: A Tensor of shape [K, 2] where K is the number of center points. The order of second dim is (y, x).
    """
    # thresholding, setting values below threshold to 0
    ctr_hmp = F.thresholded_relu(ctr_hmp, threshold)

    #NMS
    nms_padding = (nms_kernel - 1) // 2
    ctr_hmp = ctr_hmp.unsqueeze(0)
    ctr_hmp_max_pooled = F.max_pool2d(
        ctr_hmp, kernel_size=nms_kernel, stride=1, padding=nms_padding)
    ctr_hmp = ctr_hmp * (ctr_hmp_max_pooled == ctr_hmp)

    ctr_hmp = ctr_hmp.squeeze((0, 1))
    if len(ctr_hmp.shape) != 2:
        raise ValueError('Something is wrong with center heatmap dimension.')

    if top_k is None:
        top_k_score = 0
    else:
        top_k_score, _ = paddle.topk(paddle.flatten(ctr_hmp), top_k)
        top_k_score = top_k_score[-1]
    # non-zero points are candidate centers
    ctr_hmp_k = (ctr_hmp > top_k_score[-1]).astype('int64')
    if ctr_hmp_k.sum() == 0:
        ctr_all = None
    else:
        ctr_all = paddle.nonzero(ctr_hmp_k)
    return ctr_all

    Find the center points from the center heatmap.

    Args:
        ctr_hmp (Tensor): A Tensor of shape [1, H, W] of raw center heatmap output.
        threshold (float, optional): Threshold applied to center heatmap score. Default: 0.1.
        nms_kernel (int, optional): NMS max pooling kernel size. Default: 3.
        top_k (int, optional): An Integer, top k centers to keep. Default: None

    Returns:
        Tensor: A Tensor of shape [K, 2] where K is the number of center points. The order of second dim is (y, x).
    
contrib/PanopticDeepLab/core/infer.py