contextnet/models/models.py
def _decode_heatmap(self, center_heatmap_pred, kernel=3, k=400):
        """
        Transform heatmaps into predicted keypoints.
        """
        height, width = center_heatmap_pred.shape[2:]
        inp_h, inp_w = self.img_shape
        out_h, out_w = self.kp_shape

        center_heatmap_pred = self._get_local_maximum(
            center_heatmap_pred, kernel=kernel)

        *batch_dets, topk_ys, topk_xs = self._get_topk_from_heatmap(
            center_heatmap_pred, k=k)
        batch_scores, batch_topk_labels = batch_dets

        x = topk_xs * (out_w / width)
        y = topk_ys * (out_h / height)

        batch_bboxes = torch.stack([x, y], dim=2)
        batch_bboxes = torch.cat((batch_bboxes, batch_topk_labels[..., None]),
                                 dim=-1)
        batch_bboxes = batch_bboxes.numpy()
        batch_scores = batch_scores.numpy()
        return batch_bboxes, batch_scores

        Transform heatmaps into predicted keypoints.
        
Transform heatmaps into predicted keypoints.
Transform heatmaps into predicted keypoints .
def _decode_heatmap(self, center_heatmap_pred, kernel=3, k=400):
        height, width = center_heatmap_pred.shape[2:]
        inp_h, inp_w = self.img_shape
        out_h, out_w = self.kp_shape
        center_heatmap_pred = self._get_local_maximum(
            center_heatmap_pred, kernel=kernel)
        *batch_dets, topk_ys, topk_xs = self._get_topk_from_heatmap(
            center_heatmap_pred, k=k)
        batch_scores, batch_topk_labels = batch_dets
        x = topk_xs * (out_w / width)
        y = topk_ys * (out_h / height)
        batch_bboxes = torch.stack([x, y], dim=2)
        batch_bboxes = torch.cat((batch_bboxes, batch_topk_labels[..., None]),
                                 dim=-1)
        batch_bboxes = batch_bboxes.numpy()
        batch_scores = batch_scores.numpy()
        return batch_bboxes, batch_scores
def _decode_heatmap ( self , center_heatmap_pred , kernel = 3 , k = 400 ) : height , width = center_heatmap_pred . shape [ 2 : ] inp_h , inp_w = self . img_shape out_h , out_w = self . kp_shape center_heatmap_pred = self . _get_local_maximum ( center_heatmap_pred , kernel = kernel ) * batch_dets , topk_ys , topk_xs = self . _get_topk_from_heatmap ( center_heatmap_pred , k = k ) batch_scores , batch_topk_labels = batch_dets x = topk_xs * ( out_w / width ) y = topk_ys * ( out_h / height ) batch_bboxes = torch . stack ( [ x , y ] , dim = 2 ) batch_bboxes = torch . cat ( ( batch_bboxes , batch_topk_labels [ ... , None ] ) , dim = - 1 ) batch_bboxes = batch_bboxes . numpy ( ) batch_scores = batch_scores . numpy ( ) return batch_bboxes , batch_scores
Transform heatmaps into predicted keypoints.
Transform heatmaps into predicted keypoints .
"""
        Transform heatmaps into predicted keypoints.
        """
self
center_heatmap_pred
kernel
k