2024-06-20 12:01:41 发布
网友
我无法导入“应用变换”和“变换矩阵”“偏移中心”。 我尝试使用ImageDataGenerator但我也遇到了问题!在
ImageDataGenerator
from keras.preprocessing.image import apply_transform, transform_matrix_offset_center
ImportError: cannot import name 'apply_transform'
这取决于你运行的是哪个版本的keras。根据这个Github-issue,关于文档有一点混乱。当涉及到apply_transform时,post解决了最新版本的问题。在我的Keras版本(2.1.5)from keras.preprocessing.image import apply_transform起作用,但是在后面的版本中,正如前面提到的apply_transform被移到{}。在
apply_transform
from keras.preprocessing.image import apply_transform
至于transform_matrix_offset_center,根据keras.preprocessing.image的源代码,line 21中很明显,from keras.preprocessing.image import transform_matrix_offset_center应该可以工作。您可以参考releases-timeline来了解每个版本中的不同更改
transform_matrix_offset_center
line 21
from keras.preprocessing.image import transform_matrix_offset_center
这取决于你运行的是哪个版本的keras。根据这个Github-issue,关于文档有一点混乱。当涉及到}。在
apply_transform
时,post解决了最新版本的问题。在我的Keras版本(2.1.5)from keras.preprocessing.image import apply_transform
起作用,但是在后面的版本中,正如前面提到的apply_transform
被移到{至于
transform_matrix_offset_center
,根据keras.preprocessing.image的源代码,line 21
中很明显,from keras.preprocessing.image import transform_matrix_offset_center
应该可以工作。您可以参考releases-timeline来了解每个版本中的不同更改相关问题 更多 >
编程相关推荐