python - ModuleNotFoundError:没有名为“object_detection”的模块
问题描述
我尝试在 git url 下的 object_detection 中训练.py
https://github.com/tensorflow/models/tree/master/research/object_detection
但是,会发生以下错误。
ModuleNotFoundError:没有名为“object_detection”的模块
所以我尝试通过编写以下代码来解决问题。
import sys
sys.path.append('/home/user/Documents/imgmlreport/inception/models/research/object_detection')
from object_detection.builders import dataset_builder
这个问题还没有解决。
目录结构如下图所示。
~/object_detection/train.py
~/object_detection/builders/dataset_bulider.py
这是完整的错误按摩
/home/user/anaconda3/lib/python3.6/site-packages/h5py/init .py:34: FutureWarning:不推荐将 issubdtype 的第二个参数从
float
to转换np.floating
。将来,它将被视为
np.float64 == np.dtype(float).type
. 从 ._conv 导入 register_converters 作为 _register_converters回溯(最近一次通话最后):
导入培训师中的文件“train.py”,第 52 行
文件“/home/user/Documents/imgmlreport/inception/models/research/object_detection/trainer.py”,第 26 行,从 object_detection.builders 导入 optimizer_builder
ModuleNotFoundError:没有名为“object_detection”的模块
我如何导入模块?
解决方案
尝试安装打包的 TensorFlow 对象检测库
pip install tensorflow-object-detection-api
推荐阅读
- r - grepl 循环的“参数长度为零”错误
- azure - Azure DataFactory 增量 BLOB 副本
- python - Scrapy 没有在分页之后填充输出
- swift - 使用 vapor 3 在同一条路线上处理不同类型的 json
- c# - C# - 从 Dictionary 创建 JSON 对象数组
- angular - Angular HttpClient 使套接字保持打开状态
- c++ - 对齐的 malloc c++ 实现
- github - 如何标记、标记或创建 Github 存储库?
- .net - VB.NET 在运行时创建的控件上的意外锚定行为
- vba - VBA 添加相邻单元格