【问题标题】:ImageDataGenerator how to change the range of the rotation?ImageDataGenerator 如何改变旋转的范围?
【发布时间】:2018-04-26 17:44:17
【问题描述】:

是否可以在 $theta_{min}$ 和 $theta_{max}$ 之间进行循环?

ImageDataGenerator(rotation_range=90) 以 0 到 90 度之间的随机角度旋转图像,例如可以在 50 到 60 度之间旋转吗?

【问题讨论】:

    标签: database image keras image-preprocessing


    【解决方案1】:

    其实 Didier 是对的,'rotation_range=90' 表示在 [-90,90] 之间随机旋转。

    如果你想旋转一个固定的角​​度,我想你应该尝试手动编写一个函数,它对应于ImageDataGenerator中的参数'preprocessing_function'。

    'preprocessing_function' 实际上可以执行很多转换,非常灵活!

    希望对您有所帮助!

    【讨论】:

      【解决方案2】:

      在 keras 中,ImageDataGenerator(rotation_range=90) 不会旋转 0 度到 90 度之间随机角度的图像。随机角度范围为-90度和90度。

      # from ..../Anaconda3/Lib/site-packages/keras/preprocessing/image.py if self.rotation_range: theta = np.deg2rad(np.random.uniform(-self.rotation_range, self.rotation_range)) else: theta = 0

      您想要的可能是ImageDataGenerator(rotation_range=20) 以随机旋转 -20 度到 20 度之间的随机角度的图像。

      【讨论】:

        猜你喜欢
        • 2021-08-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多