nutszebra_data_augmentation_picture.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:trainer 作者: nutszebra 项目源码 文件源码
def rotate_picture_randomly(self, x_or_probability, low=-10.0, high=10.0, reshape=True):
        """Rotate picture

        Edited date:
            160521

        Test:
            160712

        Example:

        ::

            da = nutszebra_data_augmentation_picture.DataAugmentationPicture()
            da.load_picture(path).rotate_picture_randomly()

        Args:
            x_or_probability Optional([int, float, str, numpy.ndarray]): If int or float, this argument is considered as the probability and self.x is used for convert_to_image_format. If str or numpy.ndarray, set this argument as self.x and execute crop_center with self.x.
            low (float): lower bound of random value (degree)
            high (float): higher bound of random value (degree)
            reshape (bool): If True, rorated picture is reshaped
            __no_record (bool): the value of __no_record changes the value to be returned.

        Returns:
            Optional([tuple, class]): If __no_record is False, return self, otherwise return tuple(shaped x, info)
        """
        np.random.seed()
        random_value = np.random.uniform(low, high)
        return (imrotate(x_or_probability, random_value, reshape=True), {'random_value': random_value})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号