Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BiomechatronicsRookie opened this issue Jun 21, 2023 · 10 comments

Comments

@BiomechatronicsRookie
Copy link

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
Copy link

valentin-fngr commented Jun 28, 2023

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
Copy link
Author

BiomechatronicsRookie commented Jun 29, 2023

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
Copy link

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
Copy link
Author

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
Copy link

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

@Sadegh-Kalami
Copy link

Sadegh-Kalami commented Aug 3, 2023

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
Copy link

bmmtstb commented Aug 11, 2023

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 [email protected]: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
  1. install cython bbox pip install .
  2. in AlphaPose repo change every np.float to np.float32 -> RegEx finder sth. like np.float[^3]

@BiomechatronicsRookie
Copy link
Author

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

@bmmtstb
Copy link

bmmtstb commented Aug 15, 2023

For me there are still two questions open:

  • Do we really want to use np.float32 or ist float or np.float64 better? There is one PR 1 in this repo which uses float. And in valentin-fngr cython-bbox repo flaot is used too 2
  • Do other people than me have the json serializer error due to the float32 too? How can we fix that? Could the JSON be generated if we use float instead of np.float32?

@Sadegh-Kalami
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants