contextnet/models/models.py
def _get_topk_from_heatmap(self, scores, k=500):
        """Get top k positions from heatmap.
        Args:
            scores (Tensor): Target heatmap with shape
                [batch, num_classes, height, width].
            k (int): Target number. Default: 20.
        Returns:
            tuple[torch.Tensor]: Scores, indexes, categories and coords of
                topk keypoint. Containing following Tensors:
            - topk_scores (Tensor): Max scores of each topk keypoint.
            - topk_inds (Tensor): Indexes of each topk keypoint.
            - topk_clses (Tensor): Categories of each topk keypoint.
            - topk_ys (Tensor): Y-coord of each topk keypoint.
            - topk_xs (Tensor): X-coord of each topk keypoint.
        """
        batch, _, height, width = scores.size()
        topk_scores, topk_inds = torch.topk(scores.view(batch, -1), k)
        topk_clses = topk_inds // (height * width)
        topk_inds = topk_inds % (height * width)
        topk_ys = topk_inds // width
        topk_xs = (topk_inds % width).int().float()
        return topk_scores, topk_clses, topk_ys, topk_xs
Get top k positions from heatmap.
        Args:
            scores (Tensor): Target heatmap with shape
                [batch, num_classes, height, width].
            k (int): Target number. Default: 20.
        Returns:
            tuple[torch.Tensor]: Scores, indexes, categories and coords of
                topk keypoint. Containing following Tensors:
            - topk_scores (Tensor): Max scores of each topk keypoint.
            - topk_inds (Tensor): Indexes of each topk keypoint.
            - topk_clses (Tensor): Categories of each topk keypoint.
            - topk_ys (Tensor): Y-coord of each topk keypoint.
            - topk_xs (Tensor): X-coord of each topk keypoint.
        
Get top k positions from heatmap.
Get top k positions from heatmap .
def _get_topk_from_heatmap(self, scores, k=500):
        batch, _, height, width = scores.size()
        topk_scores, topk_inds = torch.topk(scores.view(batch, -1), k)
        topk_clses = topk_inds // (height * width)
        topk_inds = topk_inds % (height * width)
        topk_ys = topk_inds // width
        topk_xs = (topk_inds % width).int().float()
        return topk_scores, topk_clses, topk_ys, topk_xs
def _get_topk_from_heatmap ( self , scores , k = 500 ) : batch , _ , height , width = scores . size ( ) topk_scores , topk_inds = torch . topk ( scores . view ( batch , - 1 ) , k ) topk_clses = topk_inds // ( height * width ) topk_inds = topk_inds % ( height * width ) topk_ys = topk_inds // width topk_xs = ( topk_inds % width ) . int ( ) . float ( ) return topk_scores , topk_clses , topk_ys , topk_xs
Get top k positions from heatmap.
Get top k positions from heatmap .
"""Get top k positions from heatmap.
        Args:
            scores (Tensor): Target heatmap with shape
                [batch, num_classes, height, width].
            k (int): Target number. Default: 20.
        Returns:
            tuple[torch.Tensor]: Scores, indexes, categories and coords of
                topk keypoint. Containing following Tensors:
            - topk_scores (Tensor): Max scores of each topk keypoint.
            - topk_inds (Tensor): Indexes of each topk keypoint.
            - topk_clses (Tensor): Categories of each topk keypoint.
            - topk_ys (Tensor): Y-coord of each topk keypoint.
            - topk_xs (Tensor): X-coord of each topk keypoint.
        """
Scores, indexes, categories and coords of
topk keypoint. Containing following Tensors:
topk_scores (Tensor): Max scores of each topk keypoint.
topk_inds (Tensor): Indexes of each topk keypoint.
topk_clses (Tensor): Categories of each topk keypoint.
topk_ys (Tensor): Y-coord of each topk keypoint.
topk_xs (Tensor): X-coord of each topk keypoint.
Scores indexes categories and coords of topk keypoint . Containing following Tensors : topk_scores ( Tensor ) : Max scores of each topk keypoint . topk_inds ( Tensor ) : Indexes of each topk keypoint . topk_clses ( Tensor ) : Categories of each topk keypoint . topk_ys ( Tensor ) : Y - coord of each topk keypoint . topk_xs ( Tensor ) : X - coord of each topk keypoint .
tuple[torch.Tensor]
self
scores
Target heatmap with shape
[batch, num_classes, height, width].
Target heatmap with shape [ batch num_classes height width ] .
k
None