Giter VIP home page Giter VIP logo

cocoapi's People

Contributors

hellock avatar johnqczhang avatar mohomran avatar pdollar avatar ppwwyyxx avatar rbgirshick avatar rodrigob avatar sampepose avatar szagoruyko avatar tylin avatar xvjiarui avatar yassersouri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cocoapi's Issues

Issue while setting up cocoapi

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

customized parameter passing to accumulate function

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.

ModuleNotFoundError: No module named 'numpy'

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

gcc: error: ../common/maskApi.c: No such file or directory

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.

Evaluation are two slow compared to pycocotools

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).

In the function setDetParams(), np.linspace() may not create exact values

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)_**

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.