MVIG-SJTU / AlphaPose

Real-Time and Accurate Full-Body Multi-Person Pose Estimation&Tracking System
http://mvig.org/research/alphapose.html
Other
7.96k stars 1.97k forks source link

Cannot use tracker due to outdated use of numoy in cython bbox package #1148

Open BiomechatronicsRookie opened 1 year ago

BiomechatronicsRookie commented 1 year ago

Hi, I am trying to use the trackers recommended with alphapose, however the cython bbox packages still uses the deprecated method numpy.float instead of directly float or numpy.float64. Is there any workaround for this? One way is to downgrade numpy, this is not a possibility due to conflict with several other packages.

valentin-fngr commented 1 year ago

Hi, Happened the same to me.

You can use my package where I simply replaced the type here : https://github.com/valentin-fngr/cython_bbox This should work : pip install git+https://github.com/valentin-fngr/cython_bbox.git

BiomechatronicsRookie commented 1 year ago

Thanks it seems to have solved the issue, I will try now to see how I can use the tracking feature of alphapose.

Edit: I spoke too quickly, even installing your package as you described, still getting the same error: AttributeError: module 'numpy' has no attribute 'float'.

This time I could get this changed in the code from alphapose so that should solve it. However a new error appeared: ValueError: Buffer dtype mismatch, expected 'DTYPE_t' but got 'double'

Any idea about what this is? DTYPE_t seems to be a cython defined type

valentin-fngr commented 1 year ago

Hi,

So, I was dealing with a similar problem yesterday and realized that the alphapose code itself (not the cython package), uses np.float. Can you try to replace all np.float in the alphapose repo by np.float32 for ex ?

This solved the issue for me.

Regarding the DTYPE_t, I did not have this error but make sure you are not giving a np.float64 as input to the cython_bbox functions.

BiomechatronicsRookie commented 1 year ago

Hi,

Indeed I tried that too yesterday but ended up giving me the DTYPE_t problem. I'll keep searching and post here if I find any solution. Thank you for your help!

Sadegh-Kalami commented 1 year ago

Hi, I have the same problem did u find any solutions?

Sadegh-Kalami commented 1 year ago

EASY way to solve it but u would say I'm crazy xD

1 uninstall cython-bbox

2 go download https://github.com/yanfengliu/cython_bbox

3 edit cython_bbox.pyx (CHANGE LINE 12 : DTYPE = np.float TO DTYPE = np.float32)and the use pip install .

4 Change every single np.float to np.float32 in alphapose repo

ur welocme

bmmtstb commented 1 year ago

The above comment did not work for me, but the same procedure with the other github did work! The model now runs on every image, but the JSON Serializer cannot handle the float32. If anyone finds a solution, please come forward.

  1. python -m pip uninstall cython_bbox
  2. git clone git@github.com:valentin-fngr/cython_bbox.git
  3. in cython_bbox repo, in file src/cython_bbox.pyx change lines 12 and 13 to be:
    DTYPE = np.float32
    ctypedef np.float32_t DTYPE_t
  4. install cython bbox pip install .
  5. in AlphaPose repo change every np.float to np.float32 -> RegEx finder sth. like np.float[^3]
BiomechatronicsRookie commented 1 year ago

Great thanks for your help! It seems to be working for now implementing what @bmmtstb suggested!

bmmtstb commented 1 year ago

For me there are still two questions open:

Sadegh-Kalami commented 1 year ago

@bmmtstb maybe next time u use my advice on how to debug its better mention my work. u just used my way to run the code. u just made a more pretty way to say it. i think I was the first person that said change float to np.foalt32 or 64