我尝试在Azure ML上的计算实例上运行对象检测器。我使用Tensorflow对象检测API,并根据tensorflow.org/install/gpu安装了Tensorflow以及CUDA和CUDNN。
当执行以下命令时:
python Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=Tensorflow/workspace/models/my_ssd_mobnet --pipeline_config_path=Tensorflow/workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=2000
我得到以下错误:
2021-08-09 12:07:09.368060: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
Traceback (most recent call last):
File "Tensorflow/models/research/object_detection/model_main_tf2.py", line 32, in <module>
from object_detection import model_lib_v2
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/object_detection/model_lib_v2.py", line 29, in <module>
from object_detection import eval_util
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/object_detection/eval_util.py", line 35, in <module>
from object_detection.metrics import coco_evaluation
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/object_detection/metrics/coco_evaluation.py", line 25, in <module>
from object_detection.metrics import coco_tools
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/object_detection/metrics/coco_tools.py", line 51, in <module>
from pycocotools import coco
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pycocotools/coco.py", line 49, in <module>
import matplotlib.pyplot as plt
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2282, in <module>
switch_backend(rcParams["backend"])
File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/matplotlib/pyplot.py", line 221, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/anaconda/envs/azureml_py36/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'matplotlib_inline'
- Azure中的虚拟机正在运行Ubuntu 18.04.5 LTS.
- 我已经通过pip安装了
matplotlib
和matplotlib-inline
并成功导入 - 代码在VS code中运行,VS code连接到Azure中的计算实例。
- CUDA version 11.0 Python版本3.8.1
我在网上没有发现任何类似的问题,希望能得到任何帮助。
更改后端对我来说是这样的:
import matplotlib
matplotlib.use('Qt5Agg')