English 中文(简体)
没有名为 Experimental. pregration 的模块 。
原标题:No module named tensorflow.keras.layers.experimental.preprocessing
Below the code import numpy as np np.random.seed(0) from sklearn import datasets import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = retina from keras.models import Sequential from keras.layers import Dense from keras.optimizers import SGD below the Error message --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) ~Anaconda3libsite-packageskeras\__init__.py in 2 try: ----> 3 from tensorflow.keras.layers.experimental.preprocessing import RandomRotation 4 except ImportError: ModuleNotFoundError: No module named tensorflow.keras.layers.experimental.preprocessing During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) in 6 get_ipython().run_line_magic( config , "InlineBackend.figure_format = retina ") 7 ----> 8 from keras.models import Sequential 9 from keras.layers import Dense 10 from keras.optimizers import SGD ~Anaconda3libsite-packageskeras\__init__.py in 4 except ImportError: 5 raise ImportError( ----> 6 Keras requires TensorFlow 2.2 or higher. 7 Install TensorFlow via `pip install tensorflow` ) 8 ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow Note:` I think, the main problem is Tensorflow version. I used somes command and that s are bellow, conda create -n tf tensorflow conda activate tf and I also used the below command conda create -n tf-gpu tensorflow-gpu conda activate tf-gpu But it don t works , Please help for solve the error.
最佳回答
You need update TensorFlow. You can try with pip install tensorflow==2.0.0 or, if you use gpu version pip install tensorflow-gpu==2.0.0 If doesn t solve your issue, you can also try with 2.2.0 version. For more details, in this issue follow this answer
问题回答
you need to update the version of your TensorFlow. For me, 2.2.0 solved the problem. I also checked with the higher versions and worked ok. pip install tensorflow==2.2.0 or pip install tensorflow-gpu==2.2.0
The recent update of tensorflow changed all the layers of preprocessing from "tensorflow.keras.layers.experimental.preprocessing" to "tensorflow.keras.layers". Instead of the experimental.preprocessing, all those layers have been moved a specific location under the module of layers. Use: from tensorflow.keras.layers RandomZoom, RandomFlip, RandomRotation Hope it solves!!




相关问题
Resample Filter of WEKA - How to interpret the result

I am currently strugeling with a machine learning problem whereas I have to deal with great unbalanced data sets. That is, there are six classes ( 1 , 2 ... 6 ). Unfortunately there are e.g. for class ...

How to recognize rectangles in this image?

I have a image with horizontal and vertical lines. In fact, this image is the BBC website converted to horizontal and vertical lines. My problem is that I want to be able to find all the rectangles in ...

Question About Using Weka, the machine learning tool

I m using the explorer feature of Weka for classification. So I have my .arff file, with 2 features of NUMERIC value, and my class is a binary 0 or 1 (eg {0,1}). Sample: @RELATION summary @...

Implementing a linear, binary SVM (support vector machine)

I want to implement a simple SVM classifier, in the case of high-dimensional binary data (text), for which I think a simple linear SVM is best. The reason for implementing it myself is basically that ...

libsvm model file format

According to this FAQ the model format in libsvm should be straightforward. And in fact it is, when I call just svm-train. As an example, the first SV for the a1a dataset is 1 3:1 11:1 14:1 19:1 39:...

Competitive Learning in Neural Networks

I am playing with some neural network simulations. I d like to get two neural networks sharing the input and output nodes (with other nodes being distinct and part of two different routes) to compete. ...

热门标签