没有名为' tensorflow.keras'的模块

发布于 2025-01-21 20:09:59 字数 754 浏览 0 评论 0原文

我正在尝试使用构建验证模型的自定义对象检测模型进行介绍。我想要的只是我的模型是检测图片中的特定徽标。问题是,我遵循的指南是库存在问题。

import tensorflow as tf
from imageai.Detection.Custom import DetectionModelTrainer

trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/drive/MyDrive/Logo_Model2/")
trainer.setTrainConfig(object_names_array=["logo"], batch_size=4, num_experiments=122, train_from_pretrained_model="/content/drive/MyDrive/pretrained-yolov3.h5")
trainer.trainModel()

当我导入ImageAi.detection.custom导入检测模型元素时,我的错误即将出现。我在Google Colab上这样做,我检查了版本,它们似乎都是最新的。

ModuleNotFoundError: No module named 'tensorflow.keras'

有什么想法吗?我已经环顾了类似问题,但是我无法解决问题。这似乎不是一个张量的问题,因为我能够构建模型,直到添加ImageAi。

I am trying to play around with a custom object detection model that builds of a pretrained model. All I want is for my model is to detect a specific logo in a picture. The problem is, the guide that I am following is having problems with the libraries.

import tensorflow as tf
from imageai.Detection.Custom import DetectionModelTrainer

trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/drive/MyDrive/Logo_Model2/")
trainer.setTrainConfig(object_names_array=["logo"], batch_size=4, num_experiments=122, train_from_pretrained_model="/content/drive/MyDrive/pretrained-yolov3.h5")
trainer.trainModel()

My error is coming when I import imageai.Detection.Custom import DetectionModelTrainer. I am doing this on google colab and I checked the versions and they seem to be all up to date.

ModuleNotFoundError: No module named 'tensorflow.keras'

Any ideas? I have looked around stack for similar problems yet I haven't been able to resolve my issue. It doesn't seem to be a tensorflow problem since I am able to build my models just fine until I add imageai.

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

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

发布评论

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

评论(1

阳光的暖冬 2025-01-28 20:09:59

似乎是最新的tensorflow == 2.8.0的问题。 git问题

目前,您可以恢复回到较旧版本的TensorFlow

pip install tensorflow==2.7

和升级ImageAii ImageAii Imageaii ImageAii :

pip install imageai --upgrade

Seems to be an issue with the latest tensorflow==2.8.0. git issue

For now, you can revert back to the older version of tensorflow

pip install tensorflow==2.7

And upgrade imageAI :

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