操作系统:Ubuntu 18.04 LTS
Python环境= 3.6.8(系统默认版本)
我跟随this link安装了cocoapi。
但是,它显示以下错误:
ubuntu:~/cocoapi-master/PythonAPI$ make
python setup.py build_ext --inplace
Traceback (most recent call last):
File "setup.py", line 2, in <module>
import numpy as np
ImportError: No module named numpy
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1
我已经安装了objection_detection / g3doc / installation.md中提到的所需依赖项。
我还安装了Cython和Numpy。
有人可以帮助我解决此问题吗?预先感谢。
我运行这段代码
python3 setup.py build_ext --inplace
它没有显示错误。
但是,当我尝试运行Tensorflow / models / research / object_detection / model_main.py时,它再次显示错误。
命令行:
ubuntu:~/PycharmProjects/PedestrianDetection$ python object_detection/model_main.py --pipeline_config_path=pretrained/pipeline.config --model_dir=train --num_train_steps=1000 --sample_1_of_n_eval_examples=1 --alsologtostderr
错误:
Traceback (most recent call last):
File "object_detection/model_main.py", line 26, in <module>
from object_detection import model_lib
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/model_lib.py", line 28, in <module>
from object_detection import eval_util
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/eval_util.py", line 28, in <module>
from object_detection.metrics import coco_evaluation
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/metrics/coco_evaluation.py", line 20, in <module>
from object_detection.metrics import coco_tools
File "/home/yantong/PycharmProjects/PedestrianDetection/object_detection/metrics/coco_tools.py", line 47, in <module>
from pycocotools import coco
File "/home/yantong/PycharmProjects/PedestrianDetection/pycocotools/coco.py", line 55, in <module>
from . import mask as maskUtils
File "/home/yantong/PycharmProjects/PedestrianDetection/pycocotools/mask.py", line 3, in <module>
import pycocotools._mask as _mask
ModuleNotFoundError: No module named 'pycocotools._mask'
在〜/ PycharmProjects / PedestrianDetection / pycocotools下,我有
cocoeval.py coco.py __init__.py mask.py __pycache__
cocoeval.py.bak coco.py.bak _mask.c _mask.pyx
我想知道为什么它也没有显示名为“ pycocotools._mask”的模块。
答案 0 :(得分:1)
make
pycocotools:pip3 install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
它将安装在Ubuntu路径/home/USERNAME/.local/lib/python3.6/site-packages
/home/USERNAME/.local/lib/python3.6/site-packages
使用终端cd上面的路径。
注意:USERNAME表示您在Ubuntu上的帐户名(对我来说是yantong),请用您的帐户名替换。
cp -r pycocotools YOUR_PACKAGE_PATH
注意:最好用软件包的绝对路径替换YOUR_PACKAGE_PATH。
from pycocotools.coco import COCO
from pycocotools import mask as maskUtils
按ENTER键,如果没有错误,表示祝贺!