[英]ImportError: cannot import name 'image_dataset_from_directory' from 'tensorflow.keras.preprocessing' (unknown location)
Why am i getting this issue?为什么我会遇到这个问题? I can import image module from kera.preprocessing.我可以从 kera.preprocessing 导入图像模块。 But cannot import image_dataset_from_directory.但无法导入 image_dataset_from_directory。 TF version: 1.14 TF版本:1.14
According to this it's only available in tf-nightly, which can be installed using this:根据这个,这只是在TF-夜间,可以使用该安装可供选择:
pip install tf-nightly
Edit:编辑:
Just keeping the answer up to date, updating the tensorflow version also will solve the issue.只要保持最新的答案,更新 tensorflow 版本也将解决问题。
You can update it using pip install --upgrade tensorflow
您可以使用pip install --upgrade tensorflow
更新它
在回答时(最新的 TensorFlow 版本是 2.4.1),如果您只是升级您的 tensorflow 那么问题将得到解决,也无需安装tf-nightly
pip install --upgrade tensorflow
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.