pyk4a icon indicating copy to clipboard operation
pyk4a copied to clipboard

body tracking implementation

Open lpasselin opened this issue 4 years ago • 16 comments

Previous PR was a mess so let's continue here.

Implements body tracking with #ifdef BODY_TRACKING macros.

See README.md for instructions on how to install.

Enabling body tracking this way is a hack but we don't need to maintain two repositories.

Is there any other simple way to do this?

lpasselin avatar Aug 06 '20 21:08 lpasselin

Waiting for https://github.com/etiennedub/pyk4a/pull/59 for refactor

lpasselin avatar Sep 03 '20 16:09 lpasselin

Any tentative release date for this?

romilpunetha avatar Dec 20 '20 20:12 romilpunetha

No sorry. It used to work but now it would need a couple hours of refactor to be updated.

Is this a feature you would use? Would you be willing to help me test if I work on it?

On Sun., Dec. 20, 2020, 15:21 Romil Punetha, [email protected] wrote:

Any tentative release date for this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/etiennedub/pyk4a/pull/39#issuecomment-748665935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTB77F7EUWCBDMIXIY3RODSVZMELANCNFSM4PXAI55Q .

lpasselin avatar Dec 20 '20 21:12 lpasselin

No sorry. It used to work but now it would need a couple hours of refactor to be updated. Is this a feature you would use? Would you be willing to help me test if I work on it? On Sun., Dec. 20, 2020, 15:21 Romil Punetha, @.***> wrote: Any tentative release date for this? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#39 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTB77F7EUWCBDMIXIY3RODSVZMELANCNFSM4PXAI55Q .

Yes, I have a kinect device and am looking at making use of the body tracking sdk using python. I can help test it.

romilpunetha avatar Dec 21 '20 04:12 romilpunetha

Codecov Report

Merging #39 (da97299) into develop (7d18e35) will decrease coverage by 0.65%. The diff coverage is 75.00%.

:exclamation: Current head da97299 differs from pull request most recent head 007fb38. Consider uploading reports for the commit 007fb38 to get more accurate results

@@             Coverage Diff             @@
##           develop      #39      +/-   ##
===========================================
- Coverage    91.55%   90.90%   -0.65%     
===========================================
  Files            5        5              
  Lines          308      319      +11     
===========================================
+ Hits           282      290       +8     
- Misses          26       29       +3     
Impacted Files Coverage Δ
pyk4a/config.py 95.89% <72.72%> (-4.11%) :arrow_down:
pyk4a/pyk4a.py 89.52% <100.00%> (+0.05%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Dec 21 '20 14:12 codecov[bot]

@romilpunetha it works again!

For details, see property Capture.body_skeleton in pyk4a/capture.py

And example/pose_display_2d.py

lpasselin avatar Dec 21 '20 18:12 lpasselin

@romilpunetha it works again!

For details, see property Capture.body_skeleton in pyk4a/capture.py

And example/pose_display_2d.py

Great! I'll give it a try now.

romilpunetha avatar Dec 22 '20 05:12 romilpunetha

@romilpunetha it works again!

For details, see property Capture.body_skeleton in pyk4a/capture.py

And example/pose_display_2d.py

I'm getting the following error in reinstalling:

error: option --enable-body-tracking not recognized

Using the following command:

pip install pyk4a --no-use-pep517 --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib" --global-option="build_ext"  --global-option="--enable-body-tracking"

romilpunetha avatar Dec 22 '20 06:12 romilpunetha

I also edited the setup.py to not depend on the body tracking flag. The setup completed. However, the example is throwing the following error:

$ python example/pose_display_2d.py
Traceback (most recent call last):
  File "example/pose_display_2d.py", line 19, in <module>
    body_skeleton = capture.body_skeleton
AttributeError: 'PyK4ACapture' object has no attribute 'body_skeleton'

romilpunetha avatar Dec 22 '20 07:12 romilpunetha

The error you are getting is from wrong python code being used.

Maybe you are reusing an older pyk4a version. Make sure you install with --upgrade or pip uninstall pyk4a before installing the body tracking version. Also, try calling the example script from an other directory.

Be careful with the include paths. You are including the regular SDK files. We need them but also the body tracking sdk (it is possible they are already included). The following command is from the readme of the body tracking branch. It installs directly the code from the live branch. Notice the path is k4abt which stands for k4a body tracking:

pip install -v --no-use-pep517 --no-build-isolation --upgrade git+https://github.com/etiennedub/pyk4a.git@feature/body-tracking --global-option="build_ext" --global-option="-I/home/louis/p/pyk4a/k4abt/usr/include/" --global-option="-L/home/louis/p/pyk4a/k4abt/usr/lib/" --global-option="--enable-body-tracking"

lpasselin avatar Dec 22 '20 14:12 lpasselin

This is the full command:

pip install pyk4a --no-use-pep517 --no-build-isolation --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\windows-desktop\amd64\release\lib" --upgrade git+https://github.com/etiennedub/pyk4a.git@feature/body-tracking   --global-option="--enable-body-tracking"

I'm getting the following error due to compiler issues...fixing it:

 pyk4a/pyk4a.cpp(8): fatal error C1021: invalid preprocessor command 'warning'

romilpunetha avatar Dec 23 '20 06:12 romilpunetha

Yes, with your body tracking install paths

On Wed., Dec. 23, 2020, 01:31 Romil Punetha, [email protected] wrote:

Do I need to update these paths?

/home/louis/p/pyk4a/k4abt/usr/include/ /home/louis/p/pyk4a/k4abt/usr/lib/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/etiennedub/pyk4a/pull/39#issuecomment-749965174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTB77FZCAXKR2NJ6E4YE2DSWGFFJANCNFSM4PXAI55Q .

lpasselin avatar Dec 23 '20 12:12 lpasselin

Had some issues with the nvidia library. Fixed those and it seems to be working now. Thanks a lot for the help @lpasselin!

romilpunetha avatar Dec 27 '20 19:12 romilpunetha

Any way to run the same on ubuntu 18.04? I used the following command to install this on windows:

pip install --no-use-pep517 --no-build-isolation --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\windows-desktop\amd64\release\lib" . --force-reinstall

For ubuntu, this is what I've done for now:

sudo apt install libk4a1.4-dev
sudo apt install k4a-tools

However, when I try to run the examples, it gives the following error:

AttributeError: 'PyK4ACapture' object has no attribute 'body_skeleton'

romilpunetha avatar Mar 25 '21 04:03 romilpunetha

Any way to run the same on ubuntu 18.04? I used the following command to install this on windows:

pip install --no-use-pep517 --no-build-isolation --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\windows-desktop\amd64\release\lib" . --force-reinstall

For ubuntu, this is what I've done for now:

sudo apt install libk4a1.4-dev
sudo apt install k4a-tools

However, when I try to run the examples, it gives the following error:

AttributeError: 'PyK4ACapture' object has no attribute 'body_skeleton'

The command for linux is simpler:

pip install --no-use-pep517 --no-build-isolation --global-option=build_ext  --global-option="--enable-body-tracking" .

But I'm getting this error now:

/tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:123 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:117 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] CUDA failure 100: no CUDA-capable device is detected ; GPU=32672 ; hostname=romil-Precision-7530 ; expr=cudaSetDevice(device_id_); 


[2021-03-26 00:31:33.626] [error] [t=11666] [K4ABT] ../src/TrackerHost/TrackerHost.cpp (185): Create(). /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:123 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:117 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] CUDA failure 100: no CUDA-capable device is detected ; GPU=32672 ; hostname=romil-Precision-7530 ; expr=cudaSetDevice(device_id_); 


[2021-03-26 00:31:33.626] [error] [t=11666] [K4ABT] ../src/sdk/k4abt.cpp (38): tracker->Create(sensor_calibration, config) returned failure in k4abt_tracker_create()
Traceback (most recent call last):
 File "example/pose_display_2d.py", line 19, in <module>
   body_skeleton = capture.body_skeleton
 File "/home/romil/scifi/lib/python3.7/site-packages/pyk4a/capture.py", line 155, in body_skeleton
   self._calibration.body_tracker_handle,
 File "/home/romil/scifi/lib/python3.7/site-packages/pyk4a/calibration.py", line 131, in body_tracker_handle
   raise K4AException("Cannot create body tracker handle")
pyk4a.errors.K4AException: Cannot create body tracker handle

romilpunetha avatar Mar 25 '21 05:03 romilpunetha

Any way to run the same on ubuntu 18.04? I used the following command to install this on windows:

pip install --no-use-pep517 --no-build-isolation --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.1\sdk\include;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\lib;C:\Program Files\Azure Kinect Body Tracking SDK\sdk\windows-desktop\amd64\release\lib" . --force-reinstall

For ubuntu, this is what I've done for now:

sudo apt install libk4a1.4-dev
sudo apt install k4a-tools

However, when I try to run the examples, it gives the following error:

AttributeError: 'PyK4ACapture' object has no attribute 'body_skeleton'

The command for linux is simpler:

pip install --no-use-pep517 --no-build-isolation --global-option=build_ext  --global-option="--enable-body-tracking" .

But I'm getting this error now:

/tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:123 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:117 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] CUDA failure 100: no CUDA-capable device is detected ; GPU=32672 ; hostname=romil-Precision-7530 ; expr=cudaSetDevice(device_id_); 


[2021-03-26 00:31:33.626] [error] [t=11666] [K4ABT] ../src/TrackerHost/TrackerHost.cpp (185): Create(). /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:123 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] /tmp/onnxruntime/onnxruntime/core/providers/cuda/cuda_call.cc:117 bool onnxruntime::CudaCall(ERRTYPE, const char*, const char*, ERRTYPE, const char*) [with ERRTYPE = cudaError; bool THRW = true] CUDA failure 100: no CUDA-capable device is detected ; GPU=32672 ; hostname=romil-Precision-7530 ; expr=cudaSetDevice(device_id_); 


[2021-03-26 00:31:33.626] [error] [t=11666] [K4ABT] ../src/sdk/k4abt.cpp (38): tracker->Create(sensor_calibration, config) returned failure in k4abt_tracker_create()
Traceback (most recent call last):
 File "example/pose_display_2d.py", line 19, in <module>
   body_skeleton = capture.body_skeleton
 File "/home/romil/scifi/lib/python3.7/site-packages/pyk4a/capture.py", line 155, in body_skeleton
   self._calibration.body_tracker_handle,
 File "/home/romil/scifi/lib/python3.7/site-packages/pyk4a/calibration.py", line 131, in body_tracker_handle
   raise K4AException("Cannot create body tracker handle")
pyk4a.errors.K4AException: Cannot create body tracker handle

Solved this by disabling secure boot on ubuntu.

romilpunetha avatar Mar 30 '21 07:03 romilpunetha