(self, inputs)
return batch_data
assume order = ("images, keypoints, bboxes, info")
assume order = ("images, keypoints, bboxes, info")
assume order = ( images keypoints bboxes info )
def apply(self, inputs):
        """
        assume order = ("images, keypoints, bboxes, info")
        """
        batch_data = defaultdict(list)

        for image, keypoints, _, info in inputs:

            batch_data["data"].append(image)

            joint = keypoints[0, :, :2]
            dis = (self.grid_x[None] - joint[:, 0, None, None]) ** 2 + (
                self.grid_y[None] - joint[:, 1, None, None]
            ) ** 2
            heat_valid = np.array(keypoints[0, :, -1]).astype(np.float32)

            heatmaps = []
            for k in self.heat_kernel:

                heatmap = np.exp(-dis / 2 / k ** 2)
                heatmap[heat_valid < 0.1] = 0
                heatmap[heatmap < self.heat_thr] = 0

                heatmap *= self.heat_range

                heatmaps.append(heatmap)

            batch_data["heatmap"].append(np.array(heatmaps))
            batch_data["heat_valid"].append(heat_valid)
            batch_data["info"].append(info)

        for key, v in batch_data.items():
            if key != "info":
                batch_data[key] = np.ascontiguousarray(v).astype(np.float32)
        return batch_data
def apply ( self , inputs ) : batch_data = defaultdict ( list ) for image , keypoints , _ , info in inputs : batch_data [ "data" ] . append ( image ) joint = keypoints [ 0 , : , : 2 ] dis = ( self . grid_x [ None ] - joint [ : , 0 , None , None ] ) ** 2 + ( self . grid_y [ None ] - joint [ : , 1 , None , None ] ) ** 2 heat_valid = np . array ( keypoints [ 0 , : , - 1 ] ) . astype ( np . float32 ) heatmaps = [ ] for k in self . heat_kernel : heatmap = np . exp ( - dis / 2 / k ** 2 ) heatmap [ heat_valid < 0.1 ] = 0 heatmap [ heatmap < self . heat_thr ] = 0 heatmap *= self . heat_range heatmaps . append ( heatmap ) batch_data [ "heatmap" ] . append ( np . array ( heatmaps ) ) batch_data [ "heat_valid" ] . append ( heat_valid ) batch_data [ "info" ] . append ( info ) for key , v in batch_data . items ( ) : if key != "info" : batch_data [ key ] = np . ascontiguousarray ( v ) . astype ( np . float32 ) return batch_data