def decode(self, encoded: np.ndarray,
               offset_maps: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
        """Decode keypoint coordinates from heatmaps. The decoded keypoint
        coordinates are in the input image space.

        Args:
            encoded (np.ndarray): Heatmaps in shape (K, H, W)

        Returns:
            tuple:
            - keypoints (np.ndarray): Decoded keypoint coordinates in shape
                (N, K, D)
            - scores (np.ndarray): The keypoint scores in shape (N, K). It
                usually represents the confidence of the keypoint prediction
        """
        heatmaps = encoded.copy()

        offset_maps = offset_maps.copy()

        K, H, W = heatmaps.shape

        keypoints, scores = get_heatmap_maximum(heatmaps)

        offset_x = offset_maps[:K, ...]
        offset_y = offset_maps[K:, ...]

        keypoints_interger = keypoints.astype(np.int32)
        keypoints_decimal = np.zeros_like(keypoints)

        for i in range(K):
            [x, y] = keypoints_interger[i]
            if x < 0 or y < 0:
                x = y = 0

            # caution: torch tensor shape is nchw, so index should be i,y,x
            keypoints_decimal[i][0] = x + offset_x[i, y, x]
            keypoints_decimal[i][1] = y + offset_y[i, y, x]

        # Restore the keypoint scale
        keypoints_decimal = keypoints_decimal * self.scale_factor

        return keypoints_decimal[None], scores[None]
Decode keypoint coordinates from heatmaps. The decoded keypoint
        coordinates are in the input image space.

        Args:
            encoded (np.ndarray): Heatmaps in shape (K, H, W)

        Returns:
            tuple:
            - keypoints (np.ndarray): Decoded keypoint coordinates in shape
                (N, K, D)
            - scores (np.ndarray): The keypoint scores in shape (N, K). It
                usually represents the confidence of the keypoint prediction
        
mmpose/projects/skps/custom_codecs/skps_heatmap.py