我是按照这个教程来做的。https:/github.comRomRocobjdet_train_tensorflow_colabblobmasterobjdet_custom_tf_colab.ipynb。
当我试图运行第一段代码时,我得到了这样的错误:"我的代码是:"。
!apt-get install -qq protobuf-compiler python-tk
!pip install -q Cython contextlib2 pillow lxml matplotlib PyDrive
!pip install -q pycocotools
%cd ~/models/research
!protoc object_detection/protos/*.proto --python_out=.
import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'
!python object_detection/builders/model_builder_test.py
我得到了这个错误。
/content
object_detection/protos/*.proto: No such file or directory
python3: can't open file 'object_detection/builders/model_builder_test.py': [Errno 2] No such file or directory
我已经在Google Colab中安装了所有的库 就像教程上说的那样 所以我不明白为什么会出现这样的错误 也不知道该如何解决这个问题 任何帮助都将是非常感激的。
我能够在Google Colab中重新创建你的问题。
!apt-get install -qq protobuf-compiler python-tk
!pip install -q Cython contextlib2 pillow lxml matplotlib PyDrive
!pip install -q pycocotools
%cd ~/models/research
!protoc object_detection/protos/*.proto --python_out=.
import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'
!python object_detection/builders/model_builder_test.py
输出。
[Errno 2] No such file or directory: '/root/models/research'
/content
object_detection/protos/*.proto: No such file or directory
python3: can't open file 'object_detection/builders/model_builder_test.py': [Errno 2] No such file or directory
解决方案: 要解决这个问题,你可以改变你当前的目录。/content
到 /root/models/research
在运行你的代码之前,加入以下两行。
%cd
!git clone --quiet https://github.com/tensorflow/models.git
以下是更新后的代码
%cd
!git clone --quiet https://github.com/tensorflow/models.git
!apt-get install -qq protobuf-compiler python-tk
!pip install -q Cython contextlib2 pillow lxml matplotlib PyDrive
!pip install -q pycocotools
%cd ~/models/research
!protoc object_detection/protos/*.proto --python_out=.
import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'
!python object_detection/builders/model_builder_test.py
产出:
/root
/root/models/research
2020-05-08 15:23:47.035256: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1