GithubHelp home page GithubHelp logo

jin-s13 / xtcocoapi Goto Github PK

View Code? Open in Web Editor NEW
60.0 5.0 23.0 5.44 MB

Extended COCO-API

License: Other

Makefile 0.20% Python 64.80% C++ 13.04% C 10.50% Cython 11.46%
cocoapi crowdpose coco coco-wholebody aichallenger mmpose

xtcocoapi's Introduction

Extended COCO API (xtcocotools)

News

[2023.10.19] Release xtcocotools v1.14.3. Support python3.7~3.11 on Linux, mac and windows systems.

[2023.09.01] Release xtcocotools v1.14. Solve Cython3.x compatability.

[2022.12.27] Release xtcocotools v1.13. Fix int overflow & solve deprecation in numpy (replace np.float with np.float64).

[2022.04.10] Release xtcocotools v1.12. Fix bugs in APm and APl calculation.

[2022.02.23] Release xtcocotools v1.11. Add Windows/Mac support.

[2021.08.04] Release xtcocotools v1.10. Update installation dependencies.

[2021.07.22] Release xtcocotools v1.9. Merge some useful PRs from cocoapi.

[2021.05.19] Release xtcocotools v1.8. Fix CrowdPose evaluation.

[2021.03.22] Release xtcocotools v1.7. Support multi-part scores for COCO-WholeBody Dataset.

[2020.10.17] Release xtcocotools v1.6. Fix CrowdPose stats.

[2020.9.14] Release xtcocotools v1.5. Support COCO-WholeBody Dataset.

[2020.8.25] Release xtcocotools v1.0. Support COCO, AIChallenger, and CrowdPose Dataset.

Introduction

COCO has become a standard annotation format for the task of person keypoint detection, and is widely used for multiple datasets. Our Extended COCO API is developed based on @cocodataset/cocoapi.

We aim to provide a unified evaluation tools to support multiple human pose-related datasets, including COCO, COCO-WholeBody, CrowdPose, AI Challenger and so on.

xtcocotools has been used in MMPose framework.

We provide a simple demo_crowdpose to evaluate on CrowdPose dataset; demo_coco to evaluate on COCO dataset; and demo_coco_wholebody to evaluate on COCO-WholeBody dataset;

Requirements

  • Python 3.7+ (Lower versions are not fully tested)

Installation

To install from pip:

pip install xtcocotools

To install from source:

pip install -r requirements.txt
python setup.py install

xtcocoapi's People

Contributors

canwang-sjtu avatar irexyc avatar jin-s13 avatar luminxu avatar ly015 avatar pv-aiuta-com 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xtcocoapi's Issues

Evalution of 2d keypoints

Hello,

When I am evaluating on my predicted annotation with the ground truth annotation. My accuracy comes very low 0.004. For evaluation keypoints play and important role ?? Because when i compare "keypoint values" of ground truth with predicted values there is difference of approx 100. So, could you please me which factor is impacting the performance of accuracy. Becuause on evaluation IOU value is too low which is 0.004

Could you please give me the direction where to look for since i am working on my master thesis and i need it urgently as time constraint is there.

If possible, what is the flow for this evaluation. How it's computing the AP values .???
Awaiting for your response.

Have a good day !!

Install fails on linux

After I ran pip install -r requirements.txt

I ran the install and it fails, I also tried building from source.. not sure how to proceed

$ python setup.py install

running install
/home//anaconda3/envs/autobonk/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/home//anaconda3/envs/autobonk/lib/python3.11/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
writing manifest file 'xtcocotools.egg-info/SOURCES.txt'
running install_lib
running build_py
running build_ext
gcc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/jmb/anaconda3/envs/autobonk/include -fPIC -O2 -isystem /home//anaconda3/envs/autobonk/include -fPIC -I/home//anaconda3/envs/autobonk/lib/python3.11/site-packages/numpy/core/include -I./common -I/home//anaconda3/envs/autobonk/include/python3.11 -c ../common/maskApi.c -o build/temp.linux-x86_64-3.11/../common/maskApi.o
gcc: error: ../common/maskApi.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1

use of Makefile

what's the purpose of this Makefile and it does not appear in setup.py/readme

OverflowError: Python int too large to convert to C long

Hello!

I got here from the mmpose repository.

I got this error:
OverflowError: Python int too large to convert to C long
python = 3.8
cuda = 11.3

details below

DONE (t=6.96s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type keypoints
Traceback (most recent call last):
File "tools/train.py", line 201, in
main()
File "tools/train.py", line 190, in main
train_model(
File "d:\mmpose\mmpose\apis\train.py", line 213, in train_model
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 136, in run
epoch_runner(data_loaders[i], **kwargs)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 58, in train
self.call_hook('after_train_epoch')
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\base_runner.py", line 317, in call_hook
getattr(hook, fn_name)(self)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\hooks\evaluation.py", line 271, in after_train_epoch
self._do_evaluate(runner)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\hooks\evaluation.py", line 277, in _do_evaluate
key_score = self.evaluate(runner, results)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\runner\hooks\evaluation.py", line 367, in evaluate
eval_res = self.dataloader.dataset.evaluate(
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\mmcv\utils\misc.py", line 340, in new_func
output = old_func(*args, **kwargs)
File "d:\mmpose\mmpose\datasets\datasets\top_down\topdown_coco_dataset.py", line 326, in evaluate
info_str = self._do_python_keypoint_eval(res_file)
File "d:\mmpose\mmpose\datasets\datasets\top_down\topdown_coco_dataset.py", line 389, in _do_python_keypoint_eval
coco_eval.evaluate()
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\xtcocotools\cocoeval.py", line 262, in evaluate
self.evalImgs = [evaluateImg(imgId, catId, areaRng, maxDet)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\xtcocotools\cocoeval.py", line 262, in
self.evalImgs = [evaluateImg(imgId, catId, areaRng, maxDet)
File "C:\Users\LJ\anaconda3\envs\mmpose\lib\site-packages\xtcocotools\cocoeval.py", line 456, in evaluateImg
dtm[tind, dind] = gt[m]['id']
OverflowError: Python int too large to convert to C long

Build for Python 3.11

Hello. Could you please add support for Python 3.11 in 1.14 version of this package?

Install on Mac M1 fails

Command run:

pip install xtcocotools

Expected output: install without errors and outputs

Actual output: Installation failure with the following backtrace

[...]
Building wheels for collected packages: xtcocotools
  Building wheel for xtcocotools (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      [my_venv]/lib/python3.10/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-310
      creating build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/coco.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/mask.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/version.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/__init__.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/cocoeval.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      running build_ext
      Compiling xtcocotools/_mask.pyx because it changed.
      [1/1] Cythonizing xtcocotools/_mask.pyx
      [my_venv]/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /Users/bob/sandbox/dwpose/xtcocoapi/xtcocotools/_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      building 'xtcocotools._mask' extension
      creating build/common
      creating build/temp.macosx-13-arm64-cpython-310
      creating build/temp.macosx-13-arm64-cpython-310/common
      creating build/temp.macosx-13-arm64-cpython-310/xtcocotools
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I[my_venv]/lib/python3.10/site-packages/numpy/core/include -I./common -I[my_venv]/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c ../common/maskApi.c -o build/temp.macosx-13-arm64-cpython-310/../common/maskApi.o
      clang: error: no such file or directory: '../common/maskApi.c'
      clang: error: no input files
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xtcocotools
  Running setup.py clean for xtcocotools
Failed to build xtcocotools

Let's ignore the warnings due to updated setuptools and missing cython flags and focus on the actual error here. During install, xtcocotools/_mask.pyx is recompiled because it has allegedly changed. In the file header, we have a comment that points distutils to ../common/maskApi.c which is not found because it exists in the relative path ./common/maskApi.c to the root folder where we install from. Fixing the path resolved the install problem. I'll add a PR with the fix that solved my problem which you may or may not merge at your convenience.

pip install fails in conda in windows environment

Computer: Win10,
Package manager: Anaconda
Python: 3.8

I did a pip install xtcocotools, and it keeps giving:

ERROR: Could not find a version that satisfies the requirement xtcocotools (from versions: none)
ERROR: No matching distribution found for xtcocotools

When I build from source by cloning the repo, and doing python setup.py install, I get:

running install
running bdist_egg
running egg_info
writing xtcocotools.egg-info\PKG-INFO
writing dependency_links to xtcocotools.egg-info\dependency_links.txt
writing requirements to xtcocotools.egg-info\requires.txt
writing top-level names to xtcocotools.egg-info\top_level.txt
reading manifest file 'xtcocotools.egg-info\SOURCES.txt'
writing manifest file 'xtcocotools.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'xtcocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\nuzuegbunam\Anaconda3\envs\open-mmlab38\lib\site-packages\numpy\core\include -I./common -IC:\Users\nuzuegbunam\Anaconda3\envs\open-mmlab38\include -IC:\Users\nuzuegbunam\Anaconda3\envs\open-mmlab38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.8\Release\./common/maskApi.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

Any help on this issue?

rm install.sh

since the content in the file is very standard:

python setup.py install

add our licence

add our licence that is compatible with the original licence.
the original licence should not be deleted.

Evalution of 2d keypoints

Hello,

When I am evaluating on my predicted annotation with the ground truth annotation. My accuracy comes very low 0.004. For evaluation keypoints play and important role ?? Because when i compare "keypoint values" of ground truth with predicted values there is difference of approx 100. So, could you please me which factor is impacting the performance of accuracy. Becuause on evaluation IOU value is too low which is 0.004

Could you please give me the direction where to look for since i am working on my master thesis and i need it urgently as time constraint is there.

If possible, what is the flow for this evaluation. How it's computing the AP values .???
Awaiting for your response.

Have a good day !!

Can MMPose run in Window 10?

Hi, it seems that I managed to install MMPose in Window 10. But, when I try to run on the cmd below:

C:\MMPOSE>python demo/bottom_up_video_demo.py \configs/bottom_up/hrnet/coco/hrnet_w32_coco_512x512.py \path/hrnet_w32_coco_512x512-bcb8c247_20200816.pth \--video-path demo/demo_video.mp4 \--out-video-root vis_results 

It comes out an error message: usage: bottom_up_video_demo.py [-h] [--video-path VIDEO_PATH] [--show] [--out-video-root OUT_VIDEO_ROOT]
[--device DEVICE] [--kpt-thr KPT_THR]
pose_config pose_checkpoint
bottom_up_video_demo.py: error: unrecognized arguments: --video-path demo/demo_video.mp4 --out-video-root vis_results

Kindly advise. TQVM

installation problem on m1

While using pip install on M1, this error happened:

>>> from xtcocotools.coco import COCO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/zhouchenye/miniconda3/envs/egypt-ocr/lib/python3.9/site-packages/xtcocotools/coco.py", line 58, in <module>
    from . import mask as maskUtils
  File "/Users/zhouchenye/miniconda3/envs/egypt-ocr/lib/python3.9/site-packages/xtcocotools/mask.py", line 3, in <module>
    import xtcocotools._mask as _mask
ImportError: dlopen(/Users/zhouchenye/miniconda3/envs/egypt-ocr/lib/python3.9/site-packages/xtcocotools/_mask.cpython-39-darwin.so, 0x0002): tried: '/Users/zhouchenye/miniconda3/envs/egypt-ocr/lib/python3.9/site-packages/xtcocotools/_mask.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

After uninstall and install with source:

git clone https://github.com/jin-s13/xtcocoapi.git
pip install -r requirements.txt 
python setup.py install

The results are as follow:

(mmcv) zhouchenye@chenye-zhou xtcocoapi % pip3 list | grep xtcocotools
xtcocotools              1.13
(mmcv) zhouchenye@chenye-zhou xtcocoapi % python3 -c "from xtcocotools.coco import COCO"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/zhouchenye/Desktop/OPAY/eg-idcard-ocr/xtcocoapi/xtcocotools/coco.py", line 58, in <module>
    from . import mask as maskUtils
  File "/Users/zhouchenye/Desktop/OPAY/eg-idcard-ocr/xtcocoapi/xtcocotools/mask.py", line 3, in <module>
    import xtcocotools._mask as _mask
ModuleNotFoundError: No module named 'xtcocotools._mask'

how to build on arm platform

how to build on arm platform, such as aarch64?
error like "unable to execute 'aarch64 gcc': No such file or directory" occur when i tried installing .

setuptools and Cython should not be listed as requirements

This project does not appear to use either setuptools or Cython at runtime, so these packages should not be listed in requirements.txt. Listing them there causes unnecessary packages to be installed into the user's environment.

They are build-time dependencies, so they should be listed in pyproject.toml instead. See pycocotools for an example: https://github.com/ppwwyyxx/cocoapi/blob/4670067b35e7b65d618c9746c456fe2c1128049c/PythonAPI/pyproject.toml.

evaluate one's own dataset

How to use this library to evaluate one's own dataset, with different numbers and names of key points.
I have already resolved it. Thank you

oks set to 1 when x,y are at 0

Hi !

I am having an issue with the current api you provide. I compared it to the official api and the related code is the same.

Concerning the computeOks function, the following lines are setting x0, y0 as a twice as large bbox coordinates:
https://github.com/jin-s13/xtcocoapi/blob/master/xtcocotools/cocoeval.py#L347-L348
In my experience, in most cases, x0, y0 will be set to a negative number, while x1, y1 will be set to a very high number.

This create an issue at line https://github.com/jin-s13/xtcocoapi/blob/master/xtcocotools/cocoeval.py#L376-L378 because the dx, dy vector returned is a vector full of zeros. Under OKS computation, this suppose a perfect match and therefore an OKS of 1.

Do you mind explaining the goal of these lines ?

As a fix for me, i replaced the lines 376-378 with :

ious[i, j] = 0
continue
# measure minimum distance to keypoints in (x0,y0) & (x1,y1)
z = np.zeros((k))
dx = np.max((z, x0-xd),axis=0)+np.max((z, xd-x1),axis=0)
dy = np.max((z, y0-yd),axis=0)+np.max((z, yd-y1),axis=0)

Which set the oks to false if visibility is 0 for all keypoints. But as a results, the mAP computed is much lower and therefore doesn't match the SOTA once on mmpose repo.

Thank you for your time !

'xtcocotools' has no attribute '_mask' in Windows

I'm trying to install xtcocotools while using MMPOSE in windows.

However, the xtcocotools is so difficult to install. I don't know how to compile the _MASK.PYX file and I totally hate any C/C++ source files.

Could you please release an official windows verion? You will save my life.

>>> xtcocotools
<module 'xtcocotools' from 'E:\\mmpose\\xtcocoapi\\xtcocotools\\__init__.py'>
>>> xtcocotools._mask
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'xtcocotools' has no attribute '_mask'

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.