def transform(self, results: dict) -> Optional[dict]:
        """The transform function of :class:`LoadImage`.

        Args:
            results (dict): The result dict

        Returns:
            dict: The result dict.
        """

        if 'img' not in results:
            # Load image from file by :meth:`LoadImageFromFile.transform`
            results = super().transform(results)
        else:
            img = results['img']
            assert isinstance(img, np.ndarray)
            if self.to_float32:
                img = img.astype(np.float32)

            if 'img_path' not in results:
                results['img_path'] = None
            results['img_shape'] = img.shape[:2]
            results['ori_shape'] = img.shape[:2]

        return results
The transform function of :class:`LoadImage`.

        Args:
            results (dict): The result dict

        Returns:
            dict: The result dict.
        
mmpose/mmpose/datasets/transforms/loading.py