我想对数据运行训练,但它不能正常运行,并显示一个模块错误:
"File "train.py", line 49, in <module>
from object_detection.builders import dataset_builder
ModuleNotFoundError: No module named 'object_detection'"
据我所知,由于这个错误,对象检测文件夹中的自定义模块无法运行。这是以前发生过的。我想办法修好了,但我不记得是怎么修好的。现在,我尝试添加pythonpath或更改工作目录,但不起作用。有人能再帮我解决这个问题吗?
发布于 2019-03-02 03:10:22
克隆tensorflow模型(仅当您还没有的时候)
%%bash
git clone https://github.com/tensorflow/models.git
然后,从/tensorflow/models/research目录运行以下命令:
!python setup.py build #builds the tensorflow models (this might take a while)
!python setup.py install #Install the models
!protoc object_detection/protos/*.proto --python_out=. #protobuf compilation
cd slim
!pip install -e . #install slim
cd .. #back to research direcotry
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim #set the path
!python object_detection/builders/model_builder_test.py #Test the object detection model(optional)
如果一切正常,您将看到以下输出
在0.152秒内运行了22个测试
OK (skipped=1)
然后,您必须能够运行训练脚本而不会出现此错误。
注意:以防万一,如果你遇到了与protobuf编译器相关的错误,请将3.0.0版本放入“tensorflow/model/research”目录,然后按照上面提到的步骤操作。
wget -O protobuf.zip https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip
unzip protobuf.zip
https://stackoverflow.com/questions/54929319
复制相似问题