无法导入名称' batchNormalization'从' keras.layers.normalization'

发布于 2025-01-22 02:23:40 字数 1109 浏览 0 评论 0 原文

我正在从

我已经安装了ImageAi,TensorFlow和Kerasflow和Kerasflow和Kerasflow和Keras 。

然后,当我在python中运行此操作时,

    from imageai.Detection import ObjectDetection

我得到了

追溯(最近的电话): 文件“”,第1行,在 文件“/home/carl/python-environments/env/lib/python3.9/site-packages/imageai/detection/detection/detrong> init> init .py”,第17行,in 来自imageai.detection.yolov3.models导入yolo_main,tiny_yolo_main 文件“/home/carl/python-environments/env/lib/python3.9/site-packages/imageai/detection/yolov3/models.py”,第8行, 来自keras.layers.normorization导入batchnoralization ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization' (/home/carl/python-environments/env/lib/python3.9/site-packages/keras/layers/normalization/init .py)

已经尝试过:

    from keras.layers.normalization.batch_normalization import BatchNormalization
    from tensorflow.keras.layers import BatchNormalization

但是仍然给了我同样的错误。

I'm learning ObjectDetection from this website

I have installed ImageAI,Tensorflow and Keras.

Then when I run this in python

    from imageai.Detection import ObjectDetection

I got

Traceback (most recent call last):
File "", line 1, in
File "/home/carl/python-environments/env/lib/python3.9/site-packages/imageai/Detection/init.py", line 17, in
from imageai.Detection.YOLOv3.models import yolo_main, tiny_yolo_main
File "/home/carl/python-environments/env/lib/python3.9/site-packages/imageai/Detection/YOLOv3/models.py", line 8, in
from keras.layers.normalization import BatchNormalization
ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization' (/home/carl/python-environments/env/lib/python3.9/site-packages/keras/layers/normalization/init.py)

Already tried:

    from keras.layers.normalization.batch_normalization import BatchNormalization
    from tensorflow.keras.layers import BatchNormalization

But still gave me the same error.

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

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

发布评论

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

评论(1

椒妓 2025-01-29 02:23:40

TensorFlow v2.8.0支持TF.Keras.layers.BatchNormalization()

import tensorflow as tf
tf.keras.layers.BatchNormalization()

Tensorflow v2.8.0 support tf.keras.layers.BatchNormalization()

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