首页 > 解决方案 > 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 的第二个参数从floatto转换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 导入 o​​ptimizer_builder

ModuleNotFoundError:没有名为“object_detection”的模块

我如何导入模块?

标签: python

解决方案


尝试安装打包的 TensorFlow 对象检测库

pip install tensorflow-object-detection-api

推荐阅读