sign-language-processing / pose

Library for viewing, augmenting, and handling .pose files
https://pose-format.readthedocs.io/en/latest/
MIT License
77 stars 23 forks source link

3D hand normalization with empty frames #40

Closed J22Melody closed 1 year ago

J22Melody commented 1 year ago

I am trying the code from https://github.com/sign-language-processing/pose/pull/36.

When I input a .pose file where the first few frames are empty (=no right hand detected and all values are 0s), normalization output becomes all nans, where 0s are expected.

Since the pose data is a masked array, I use pose.body.data.toflex() to inspect the arrays and now I have to use np.nan_to_num(pose.body.data) as a workaround to convert the nans back to 0s.

@AmitMY maybe worth checking the 0-handing logic in the code?

AmitMY commented 1 year ago

I'll need to see a reproduction (google colab perhaps). In any case, the correct way to get the value from a masked array is pose.body.data.filled(0)

J22Melody commented 1 year ago

https://colab.research.google.com/drive/1XyfAoKeTDRakiCHYEFgsEoceciaIlsar

AmitMY commented 1 year ago

Now this is done in the code https://github.com/sign-language-processing/pose/commit/d98ca47aed3e48dd41b885f521b755163893e2fa