图像数据生成器中已经存在错误

发布于 2025-01-27 10:44:10 字数 590 浏览 4 评论 0 原文

generator = tf.keras.preprocessing.image.ImageDataGenerator(featurewise_center=False,
samplewise_center=False,
featurewise_std_normalization=False,
samplewise_std_normalization=False,
zca_whitening=False,
rotation_range=0,
width_shift_range=0.0,
height_shift_range=0.0,
brightness_range=None,
shear_range=0.0,
zoom_range=0.0,
channel_shift_range=0.0,
cval=0.0,
horizontal_flip=False,
vertical_flip=False,
rescale=1./255,
preprocessing_function=None,
data_format=None,
validation_split=0.0,
dtype=None) 

我在这一行中已经存在错误。它仅在Anaconda的基础环境中起作用。即使已安装了所需的库,它在其他环境中也无效

generator = tf.keras.preprocessing.image.ImageDataGenerator(featurewise_center=False,
samplewise_center=False,
featurewise_std_normalization=False,
samplewise_std_normalization=False,
zca_whitening=False,
rotation_range=0,
width_shift_range=0.0,
height_shift_range=0.0,
brightness_range=None,
shear_range=0.0,
zoom_range=0.0,
channel_shift_range=0.0,
cval=0.0,
horizontal_flip=False,
vertical_flip=False,
rescale=1./255,
preprocessing_function=None,
data_format=None,
validation_split=0.0,
dtype=None) 

I'm getting already exist error in this line. It only works base environment in anaconda. It doesn't work in other environments even though the required libraries are installed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵情客 2025-02-03 10:44:10

在使用上述API和最新依赖项之后,没有帮助不建议新代码,被 devered

使用 tf.data.dataaset 带有预处理层。

有关更多信息,请参阅教程,以获取加载图像和增强图像的教程,以及预处理层指南

Having used the mentioned api with the latest dependencies won't help as tf.keras.preprocessing.image.ImageDataGenerator is not recommended for new code , being Deprecated.

Use the tf.keras.utils.image_dataset_from_directory and transforming the output tf.data.Dataset with preprocessing layers.

For more information, see the tutorials for loading images and augmenting images, as well as the preprocessing layer guide here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文