def _convert(self, apply_to: Type,
                 func: Callable[[Any], Any]) -> 'MultilevelPixelData':
        """Convert data items with the given function.

        Args:
            apply_to (Type): The type of data items to apply the conversion
            func (Callable): The conversion function that takes a data item
                as the input and return the converted result

        Returns:
            MultilevelPixelData: the converted data element.
        """
        new_data = self.new()
        for k, v in self.items():
            if is_list_of(v, apply_to):
                v = [func(_v) for _v in v]
                data = {k: v}
                new_data.set_data(data)
        return new_data
Convert data items with the given function.

        Args:
            apply_to (Type): The type of data items to apply the conversion
            func (Callable): The conversion function that takes a data item
                as the input and return the converted result

        Returns:
            MultilevelPixelData: the converted data element.
        
mmpose/mmpose/structures/multilevel_pixel_data.py