使用Tensorflow.keras.layers使用输入函数找到的模块找不到

发布于 2025-02-04 09:01:35 字数 1866 浏览 2 评论 0原文

我是非常新的学习机器学习,我的第一个项目是创建神经网络,以检测Google CoLab上的关键面部点。一切都很好,但是今天,当我想训练我的神经网络时,我出现了一个错误,当我训练神经网络时从未出现过。

错误是:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-189-47fd3efd0229> in <module>()
      5
      6 
----> 7 X_input = Input(input_shape)
      8 
      9 # Zero-padding

4 frames
/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'keras.engine.base_layer_v1'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

我不了解行modulenotfounderror:no模块名为'keras.engine.base_layer_v1',因为当我使用 input 来自 tensorflow.keras.layers

我真的不知道发生了什么,因为我以前从未遇到过这个错误。我已经看到它可能是TensorFlow的版本或我的库。

我在Tensorflow和Keras中使用2.3.0版本,这些是我正在导入的库:

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications import DenseNet121
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.initializers import glorot_uniform
from tensorflow.keras.utils import plot_model
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping, ModelCheckpoint, LearningRateScheduler
from IPython.display import display
from tensorflow.python.keras import *
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras import layers, optimizers
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.layers import *
from tensorflow.keras import backend as K
from keras import optimizers

我真的很感谢任何帮助:)

Im quite new learning machine learning and my first project is the creation of a Neural Network in order to detect key facial points on google colab. Everything has been working ok but today when I wanted to train my neural network I came accross with an error that has never appeared before when I trained my neural network.

The error is:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-189-47fd3efd0229> in <module>()
      5
      6 
----> 7 X_input = Input(input_shape)
      8 
      9 # Zero-padding

4 frames
/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'keras.engine.base_layer_v1'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

I don't understand the line ModuleNotFoundError: No module named 'keras.engine.base_layer_v1' because the line that is not working is when I'm using Input from tensorflow.keras.layers.

I really don't know what is going on because I never got this error before. I've seen that it could be the version of TensorFlow or maybe my libraries.

I am using 2.3.0 versions in TensorFlow and Keras and these are the libraries I am importing:

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications import DenseNet121
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.initializers import glorot_uniform
from tensorflow.keras.utils import plot_model
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping, ModelCheckpoint, LearningRateScheduler
from IPython.display import display
from tensorflow.python.keras import *
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras import layers, optimizers
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.layers import *
from tensorflow.keras import backend as K
from keras import optimizers

I would really appreciate any help :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红ご颜醉 2025-02-11 09:01:35

重新安装TensorFlow和Keras为我工作

Re-installing tensorflow and keras works for me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文