Comments (26)
The specific function (tf.keras.preprocessing.image_dataset_from_directory) is not available under TensorFlow v2.1.x or v2.2.0 yet. It is only available with the tf-nightly
builds and is existent in the source code of the master branch.
https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image_dataset_from_directory
For more information about installing nightly builds of TensorFlow, you can refer to https://www.tensorflow.org/install or use
pip install tf-nightly
Thanks.
from keras-io.
Its pretty sad that this team can't even provide a working tutorial
from keras-io.
@fchollet Is the whole documentation hosted at keras.io website designed around tf-nightly as of now?
Yes. These features will be in TF 2.3. Past 2.3 we don't expect that there will be discrepancies between the docs and the latest released API.
from keras-io.
Yes. These features will be in TF 2.3. Past 2.3 we don't expect that there will be discrepancies between the docs and the latest released API.
The same error is still there in Tensorflow Version 2.4
Can confirm.
The example in https://www.tensorflow.org/tutorials/load_data/images uses keras.utils,
and both are missing:
>>> tf.__version__
'2.4.1'
>>> import tensorflow.keras.utils
>>> dir(tf.keras.utils)
['CustomObjectScope', 'GeneratorEnqueuer', 'OrderedEnqueuer', 'Progbar', 'Sequence', 'SequenceEnqueuer', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sys', 'custom_object_scope', 'deserialize_keras_object', 'get_custom_objects', 'get_file', 'get_registered_name', 'get_registered_object', 'get_source_inputs', 'model_to_dot', 'normalize', 'pack_x_y_sample_weight', 'plot_model', 'register_keras_serializable', 'serialize_keras_object', 'to_categorical', 'unpack_x_y_sample_weight']
>>> import tensorflow.keras.preprocessing
2021-10-17 16:13:03.445692: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
>>> dir(tensorflow.keras.preprocessing)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sys', 'image', 'image_dataset_from_directory', 'sequence', 'text', 'text_dataset_from_directory', 'timeseries_dataset_from_array']
from keras-io.
@fchollet Is the whole documentation hosted at keras.io website designed around tf-nightly as of now?
Yes. These features will be in TF 2.3. Past 2.3 we don't expect that there will be discrepancies between the docs and the latest released API.
The same error is still there in Tensorflow Version 2.4
from keras-io.
I've got the same problem using the version '2.4.0', but the problem was solved with the following:
tf.keras.preprocessing.image_dataset_from_directory()
from keras-io.
The same issue too in TF2.5.2
tf.__version__
'2.5.2'
dir(tf.keras.utils)
['CustomObjectScope', 'GeneratorEnqueuer', 'OrderedEnqueuer', 'Progbar', 'Sequence', 'SequenceEnqueuer', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sys', 'custom_object_scope', 'deserialize_keras_object', 'experimental', 'get_custom_objects', 'get_file', 'get_registered_name', 'get_registered_object', 'get_source_inputs', 'model_to_dot', 'normalize', 'pack_x_y_sample_weight', 'plot_model', 'register_keras_serializable', 'serialize_keras_object', 'to_categorical', 'unpack_x_y_sample_weight']
from keras-io.
I wish I can transition my GPU too ;) So what's the point of Keras and why not just use TF directly ? I think I'm missing some point :(
Seems like you're deep learning on an AMD GPU with Plaid ML + Keras!
And, you're correct TensorFlow 2.0 is tightly coupled with Keras API and hence, using tf.keras from tensorflow_v2 is the current default for Keras!
https://github.com/keras-team/keras#multi-backend-keras-and-tfkeras
from keras-io.
I wish I can transition my GPU too ;) So what's the point of Keras and why not just use TF directly ? I think I'm missing some point :(
Seems like you're deep learning on an AMD GPU with Plaid ML + Keras!
And, you're correct TensorFlow 2.0 is tightly coupled with Keras API and hence, using tf.keras from tensorflow_v2 is the current default for Keras!
Yes I currently only have AMD GPUs and I wrote GA OpenCL kernel for it it was working fine but I wanted to see what other people are doing and I was sure there are LOT better implementation than mine for machine learning (and better optimized kernels). But everything I find is NVIDIA bound - it;s like NVIDIA is paying developers NOT to use anything else and it's really frustrating and it's making me not to want to even see NVIDIA product in my life ;) I can always go buy a new GPU but Now i'm pissed at NVIDIA lol.
from keras-io.
After reviewing some parts of the new keras.io website, I could also find other examples and source code that involves function calls and reference to classes only available with tf-nightly
(or in the master branch of TensorFlow). As also observed in, https://keras.io/examples/keras_recipes/quasi_svm/ where the tf.keras.layers.experimental.RandomFourierFeatures
have been used.
keras-io/examples/keras_recipes/quasi_svm.py
Lines 39 to 47 in a3bb3dc
/cc: @fchollet Is the whole documentation hosted at keras.io website designed around tf-nightly
as of now?
from keras-io.
Thanks for the clarification.
from keras-io.
When is TF 2.3 expected to be released more or less?
from keras-io.
TensorFlow 2.2 was just released one and half weeks before. Although, there is no definitive announcement about the exact release date of next release cycle, the TensorFlow community usually releases major version updates like once in 5-6 months.
Meanwhile, most of the code on this repo can be runt using the tf-nightly
package as well as most examples should be fine when directly runt on TensorFlow 2.2 itself.
If you are experiencing any issues, please try:
pip install tf-nightly # nightly builds of the tensorflow master branch released each night
And, you should be up and doing in no time!
from keras-io.
I am also getting the same error. Can anyone help me how to resolve this?
module 'tensorflow.keras.preprocessing' has no attribute 'image_dataset_from_directory'
from keras-io.
TensorFlow 2.2 was just released one and half weeks before. Although, there is no definitive announcement about the exact release date of next release cycle, the TensorFlow community usually releases major version updates like once in 5-6 months.
Meanwhile, most of the code on this repo can be runt using thetf-nightly
package as well as most examples should be fine when directly runt on TensorFlow 2.2 itself.If you are experiencing any issues, please try:
pip install tf-nightly # nightly builds of the tensorflow master branch released each night
And, you should be up and doing in no time!
Please try installing the tf-nightly
package in case you're trying to use image_dataset_from_directory
function in your code.
from keras-io.
Hi i was gettin "module 'tensorflow.keras.preprocessing' has no attribute 'image_dataset_from_directory'" so i run the pip install tf-nightly.
but now i am getting a new error message cannot import name 'image_dataset_from_directory' from 'tensorflow.keras.preprocessing.image' (/Users/xxx/anaconda3/lib/python3.7/site-packages/tensorflow/keras/preprocessing/image/init.py)
appreciate any suggestion to fix this! Thanks
from keras-io.
Hi i was gettin "module 'tensorflow.keras.preprocessing' has no attribute 'image_dataset_from_directory'" so i run the pip install tf-nightly.
but now i am getting a new error message cannot import name 'image_dataset_from_directory' from 'tensorflow.keras.preprocessing.image' (/Users/xxx/anaconda3/lib/python3.7/site-packages/tensorflow/keras/preprocessing/image/init.py)
appreciate any suggestion to fix this! Thanks
I also experienced this the other day. (I haven't tried it again since then, though).
from keras-io.
Now that tensorflow 2.3 is released, image_dataset_from_directory actually works.
from keras-io.
Does that mean that if I use PlaidML there is no chance I can use those functions ?
from keras-io.
Does that mean that if I use PlaidML there is no chance I can use those functions ?
Keras has deprecated support for multi backends for quite some time now. The only option here to try out the every new feature that Keras API offers is to stick to the TensorFlow backend a.k.a. tf.keras.
Look into transitioning your codebase to tf.keras and TensorFlow 2.0 for all the goodness that comes with Eager execution and high level Deep Learning APIs.
from keras-io.
I wish I can transition my GPU too ;) So what's the point of Keras and why not just use TF directly ? I think I'm missing some point :(
from keras-io.
@TByte007 Probably, you should try ROCm TensorFlow which is a community supported TF port delivering implementations so that we can run TF2.x on AMD GPUs.
https://github.com/ROCmSoftwarePlatform/tensorflow-upstream
from keras-io.
@TByte007 Probably, you should try ROCm TensorFlow which is a community supported TF port delivering implementations so that we can run TF2.x on AMD GPUs.
That's what I'm about to try given the chance, the problem is that ROCm is not supported under Windows and I cant fit my AMD cards (or even one card) in the Linux machine I have (well , it's never easy I guess). So far PlaidML-Keras under windows works fine and faster than my implementation but sooner or later I have to switch.
from keras-io.
The specific function (tf.keras.preprocessing.image_dataset_from_directory) is not available under TensorFlow v2.1.x or v2.2.0 yet. It is only available with the
tf-nightly
builds and is existent in the source code of the master branch.
https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image_dataset_from_directoryFor more information about installing nightly builds of TensorFlow, you can refer to https://www.tensorflow.org/install or use
pip install tf-nightlyThanks.
tf-nightly library fixed the error. Thanks
from keras-io.
It's March and the problems are still here...
from keras-io.
Same issue here on mac
>>> tf.__version__
'2.3.0'
>>> dir(tf.keras.utils)
['CustomObjectScope', 'GeneratorEnqueuer', 'HDF5Matrix', 'OrderedEnqueuer', 'Progbar', 'Sequence', 'SequenceEnqueuer', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sys', 'convert_all_kernels_in_model', 'custom_object_scope', 'deserialize_keras_object', 'get_custom_objects', 'get_file', 'get_registered_name', 'get_registered_object', 'get_source_inputs', 'model_to_dot', 'multi_gpu_model', 'normalize', 'pack_x_y_sample_weight', 'plot_model', 'register_keras_serializable', 'serialize_keras_object', 'to_categorical', 'unpack_x_y_sample_weight']
from keras-io.
Related Issues (20)
- kagglecatsanddogs_5340.zip not available to downoad - image_classification_from_scratch.py HOT 4
- Problem with training yolov8 on TPU
- model not converging the sparse categorical accuracy stays same for the whole epochs. HOT 6
- batch out of range & loss value becomes 'nan' when running monocular depth estimation HOT 6
- How to make individual predictions using the FNet example? HOT 4
- Multi-GPU distributed training with PyTorch
- [Movielens Example] Impossibile to save model: Cannot serialize object Ellipsis HOT 4
- TypeError: Sampler.__call__() got an unexpected keyword argument 'end_token_id' HOT 2
- ValueError: The filepath provided must end in `.keras` (Keras model format). Received: filepath=Model_ckpt.h5 HOT 10
- Hardware requirement for examples/rl/deep_q_network_breakout.py? HOT 5
- bayesian_neural_networks failed with Mixed Precision enabled HOT 3
- Would it be possible to make lstm_seq2seq support mixed precision? HOT 1
- Will it be a good Idea to add a tutorial to train a Image Classification suing ViT using CLS token. HOT 2
- Cannot export a slightly customized XLMRoberta model from keras_nlp HOT 1
- tutorial bug in consistency_training HOT 4
- Help runing the lastest version of ".\examples\vision\captcha_ocr.py" HOT 1
- Timeseries Classification Transformer: Last -> First HOT 4
- GTP miniature model don't load. HOT 4
- StableDiffusion example doesn't currently work without adjustment
- Incorrect Links for Keras CV
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras-io.