ImportError: cannot import name 'image_dataset_from_directory' from 'tensorflow.keras.preprocessing' (unknown location)

Viewed 7906

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

2 Answers

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

At the time of answering(the latest TensorFlow version is 2.4.1) and if you simply upgrade your tensorflow then issue will be resolved, also no need to install tf-nightly

pip install --upgrade tensorflow
Related