open-mmlab / cocoapi Goto Github PK
View Code? Open in Web Editor NEWThis project forked from cocodataset/cocoapi
COCO API - Dataset @ http://cocodataset.org/
License: Other
This project forked from cocodataset/cocoapi
COCO API - Dataset @ http://cocodataset.org/
License: Other
Hello Guys,
ModuleNotFoundError: No module named 'pycocotools' happened after running pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools" -U, would you please help me out?
In the step: pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
I am getting following error:
Building wheel for mmpycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /xxx/Python/miniconda3/envs/torch1.5cu101/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-zlq4o34_/pycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-zlq4o34_/pycocotools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-izl_v7fr
cwd: /tmp/pip-req-build-zlq4o34_/pycocotools
Complete output (63 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-3.7/pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/common
creating build/temp.linux-x86_64-3.7/pycocotools
gcc -pthread -B /xxx/Python/miniconda3/envs/torch1.5cu101/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/xxx/Python/miniconda3/envs/torch1.5cu101/lib/python3.7/site-packages/numpy/core/include -Icommon -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/include/python3.7m -c common/maskApi.c -o build/temp.linux-x86_64-3.7/common/maskApi.o
common/maskApi.c: In function ‘rleDecode’:
common/maskApi.c:46:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
^~~
common/maskApi.c:46:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
^
common/maskApi.c: In function ‘rleFrPoly’:
common/maskApi.c:166:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
^~~
common/maskApi.c:166:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
^
common/maskApi.c:167:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
^~~
common/maskApi.c:167:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
^
common/maskApi.c: In function ‘rleToString’:
common/maskApi.c:212:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(more) c |= 0x20; c+=48; s[p++]=c;
^~
common/maskApi.c:212:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if(more) c |= 0x20; c+=48; s[p++]=c;
^
common/maskApi.c: In function ‘rleFrString’:
common/maskApi.c:220:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
^~~~~
common/maskApi.c:220:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
^~~~
common/maskApi.c:228:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~
common/maskApi.c:228:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~~~
common/maskApi.c: In function ‘rleToBbox’:
common/maskApi.c:141:31: warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
^
gcc -pthread -B /xxx/Softies/Python/miniconda3/envs/torch1.5cu101/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/lib/python3.7/site-packages/numpy/core/include -Icommon -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o
gcc: error: pycocotools/_mask.c: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mmpycocotools
Environment:
certifi==2020.11.8
cycler==0.10.0
Cython==0.29.21
future==0.18.2
kiwisolver==1.3.1
matplotlib==3.3.3
mkl-fft==1.2.0
mkl-random==1.1.1
mkl-service==2.3.0
mmcv==0.5.4
mmpycocotools==12.0.3
numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1603479632437/work
olefile==0.46
opencv-python==4.4.0.46
Pillow==6.2.2
pyparsing==2.4.7
python-dateutil==2.8.1
six @ file:///tmp/build/80754af9/six_1605205313296/work
terminaltables==3.1.0
torch==1.5.1
torchvision==0.6.0a0+35d732a
Hello mmlab,
It's great to see COCO and LVIS API merged into one repo.
However, the original python api still suffers from slow evaluation speed (~ minutes). AFAIK, NVIDIA has brought a C++ extension (https://github.com/NVIDIA/cocoapi/blob/nvidia/master/PythonAPI/pycocotools/ext.cpp) , which can print the mAP & mAR table in less than one second, nearly in a flash. Would you consider introducing the extension into this repo?
There is no Git in the environment. In mmdetection install. Md, cocopyTool cannot be installed. How to install the CocopyTool without using Git?
Thank you!
Could this module support windows build (with vs2015/2017 ) and python 3, just like https://github.com/philferriere/cocoapi?
Hi,
When I pass customized parameter p with p.catIds = [15, 30] into COCOEval.accumulate, k_list would return [0, 1] since both 15 and 30 are in the original set of COCO catIds.
# retrieve E at each category, area range, and max number of detections
for k, k0 in enumerate(k_list):
Nk = k0 * A0 * I0
for a, a0 in enumerate(a_list):
Na = a0 * I0
for m, maxDet in enumerate(m_list):
E = [self.evalImgs[Nk + Na + i] for i in i_list]
But E will retrieve information of category id 0, 1 instead of the specified 15, 30. The same logic applies to a_list and i_list as well.
setup.py is missing numpy dependency, thus pip install mmpycocotools
results in the following error:
Collecting mmpycocotools==12.0.3
Downloading mmpycocotools-12.0.3.tar.gz (23 kB)
ERROR: Command errored out with exit status 1:
command: /opt/hostedtoolcache/Python/3.7.9/x64/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n55lzqzx/mmpycocotools_9bb1c99532a34da6852d8374c105fb62/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n55lzqzx/mmpycocotools_9bb1c99532a34da6852d8374c105fb62/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-b5d_sp_l
cwd: /tmp/pip-install-n55lzqzx/mmpycocotools_9bb1c99532a34da6852d8374c105fb62/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-n55lzqzx/mmpycocotools_9bb1c99532a34da6852d8374c105fb62/setup.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/99/51/1bc1d79f296347eeb2d1a2e0606885ab1e4682833bf275fd39c189952e26/mmpycocotools-12.0.3.tar.gz#sha256=b26f0b3504fad0be8fdb19f3cfa34d86f4ef97694bb403d172f9e7827781b539 (from https://pypi.org/simple/mmpycocotools/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mmpycocotools==12.0.3
ERROR: No matching distribution found for mmpycocotools==12.0.3
Error: Process completed with exit code 1.
Same error can be seen in these action workflows: ubuntu-latest python-3.7, ubuntu-latest python-3.8, windows-latest python-3.8 macos-latest python-3.8
When running:pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
I get "Running setup.py install for mmpycocotools did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running install
/opt/conda/envs/openmmlab/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
gcc -pthread -B /opt/conda/envs/openmmlab/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/envs/openmmlab/lib/python3.8/site-packages/numpy/core/include -Icommon -I/opt/conda/envs/openmmlab/include/python3.8 -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-38/../common/maskApi.o
gcc: error: ../common/maskApi.c: No such file or directory
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mmpycocotools
"
Please help, thanks in advance.
Hi,
I am trying to evaluate result by mmpycocotools=12.0.3. However, the evaluation is two slow. (> 20mins ; about 6600 images). I killed the process by CTRL-C and got below messages:
`
Evaluating bbox...
Loading and preparing results...
DONE (t=33.08s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type bbox
^CTraceback (most recent call last):
File "tools/test.py", line 244, in
main()
File "tools/test.py", line 238, in main
print(dataset.evaluate(outputs, **eval_kwargs))
File "xxxxxxx/mmdet/datasets/coco.py", line 492, in evaluate
cocoEval.evaluate()
File "xxxxxxx/lib/python3.7/site-packages/mmpycocotools-12.0.3-py3.7-linux-x86_64.egg/pycocotools/cocoeval.py", line 163, in evaluate
evaluateImg(imgId, catId, areaRng, maxDet) for catId in catIds
File "xxxxxxx/lib/python3.7/site-packages/mmpycocotools-12.0.3-py3.7-linux-x86_64.egg/pycocotools/cocoeval.py", line 164, in
for areaRng in p.areaRng for imgId in p.imgIds
File "xxxxxxx/lib/python3.7/site-packages/mmpycocotools-12.0.3-py3.7-linux-x86_64.egg/pycocotools/cocoeval.py", line 296, in evaluateImg
if gtm[tind, gind] > 0 and not iscrowd[gind]:
KeyboardInterrupt
Traceback (most recent call last):
File "xxxxxxx/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "xxxxxxx/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "xxxxxxx/lib/python3.7/site-packages/torch/distributed/launch.py", line 261, in
main()
File "xxxxxxx/lib/python3.7/site-packages/torch/distributed/launch.py", line 254, in main
process.wait()
File "xxxxxxx/lib/python3.7/subprocess.py", line 990, in wait
return self._wait(timeout=timeout)
File "xxxxxxx/lib/python3.7/subprocess.py", line 1624, in _wait
(pid, sts) = self._try_wait(0)
File "xxxxxxx/lib/python3.7/subprocess.py", line 1582, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt
`
Compared to pycocotools:
Loading and preparing results... DONE (t=2.94s) creating index... index created! Running per image evaluation... Evaluate annotation type *bbox* DONE (t=172.79s). Accumulating evaluation results... DONE (t=6.67s).
Lines 357 to 358 in 01f805c
As descriped at upstream:
np.float
was a deprecated alias for the builtinfloat
. To avoid this error in existing code, usefloat
by itself.
see also lvis-dataset/lvis-api#37
Could this be installed under the conda virtual env?
Ubuntu 18.04, AMD Ryzen 3700x
MMCV: 1.0.5
MMDetection: 2.3.0+68d860d
MMDetection Compiler: GCC 7.5
MMDetection CUDA Compiler: 10.1
In the function setDetParams(), the code:
self. iouThrs = np.linspace(.5,
0.95,
int(np.round((0.95 - .5) / .05)) + 1,
endpoint=True)
self.recThrs = np.linspace(.0,
1.00,
int(np.round((1.00 - .0) / .01)) + 1,
endpoint=True)
I found the self. iouThrs values are like:
[0.5 , 0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.8999999 , 0.95]
The self.recThrs has the same issues.
So I changed those codes as below and tested ok. Please check if the modification is ok.
iouThrs = np.linspace(.5,
0.95,
int(np.round((0.95 - .5) / .05)) + 1,
endpoint=True)
self.iouThrs = **_np.round(iouThrs, decimals=2)_**
recThrs = np.linspace(.0,
1.00,
int(np.round((1.00 - .0) / .01)) + 1,
endpoint=True)
self.recThrs = **_np.round(recThrs, decimals=2)_**
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.