简体   繁体   中英

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. But cannot import image_dataset_from_directory. TF version: 1.14

According to this it's only available in tf-nightly, which can be installed using this:

pip install tf-nightly

Edit:

Just keeping the answer up to date, updating the tensorflow version also will solve the issue.

You can update it using pip install --upgrade tensorflow

在回答时(最新的 TensorFlow 版本是 2.4.1),如果您只是升级您的 tensorflow 那么问题将得到解决,也无需安装tf-nightly

pip install --upgrade tensorflow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM