Tensorflow对象检测评估pycocotools缺失

问题描述 投票:4回答:5

关于宠物物体检测的TF教程:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_pets.md

当地人:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_locally.md

培训似乎运作良好。

试图启动评估过程:

From the tensorflow/models/research/ directory

python object_detection / eval.py \ --logtostderr \ --pipeline_config_path = $ {PATH_TO_YOUR_PIPELINE_CONFIG} \ --checkpoint_dir = $ {PATH_TO_TRAIN_DIR} \ --eval_dir = $ {PATH_TO_EVAL_DIR}

我收到以下错误:

来自pycocotools导入coco \ ModuleNotFoundError:没有名为'pycocotools'的模块

看看coco API,但我没有看到任何明确的方法在Windows上安装它。

关于如何以最简单的方式运行评估的任何建议?


有关错误消息的更多详细信息:

Traceback (most recent call last):   File "object_detection/eval.py", line 50, in <module>
from object_detection import evaluator
File "D:\models\research\object_detection\evaluator.py", line 27, in <module>
from object_detection.metrics import coco_evaluation
File "D:\models\research\object_detection\metrics\coco_evaluation.py", line 20, in <module>
from object_detection.metrics import coco_tools
File "D:\models\research\object_detection\metrics\coco_tools.py", line 47, in <module>
from pycocotools import coco ModuleNotFoundError: No module named 'pycocotools'
tensorflow object-detection evaluation
5个回答
8
投票

这为我解决了同样的问题:

pip3 install -U scikit-image
pip3 install -U cython 
pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

(如果使用的是python 2.7,请使用pip而不是pip3)


0
投票

你可以发布完整的堆栈跟踪,以便我们可以看到从哪里导入pycocotools?我们正在为Tensorflow Object-Detection API添加COCO支持(还有其他一些好东西),并且很快就会更新安装说明。


0
投票

我有同样的问题并解决了它,但不幸的是,我正在研究Ubuntu。但希望这可以帮助其他人解决同样的问题:

首先,您需要按照对象检测API的安装指南中描述的步骤进行操作。在我的情况下,这还不够,我遇到了和以前一样的问题。在那里描述的安装过程中,您下载了一个github存储库,特别是this one.

我接下来要做的是导航到文件夹cocoapi / PythonAPI并运行

sudo python3 setup.py install

评估脚本现在似乎正在运行。


0
投票

这对我有用:

git clone https://github.com/cocodataset/cocoapi

然后在PythonAPI目录中,安装库:

cd PythonAPI
python setup.py build_ext install

0
投票

对于Windows,可靠的方法是:

  1. 使用默认选择从https://go.microsoft.com/fwlink/?LinkId=691126安装Visual C ++ 2015构建工具。
  2. pip install git + https://github.com/philferriere/cocoapi.git#egg=pycocotools ^&subdirectory = PythonAPI
© www.soinside.com 2019 - 2024. All rights reserved.