Feature/body tracking
2 changes in this branch / pr:
- enable body tracking by default, so no extra build-time params are required
- add the body track id, so each body can be uniquely identified
Hi and thanks for the PR!
I always assumed body_id was simply an index. After seeing your PR, I assume body_id is unique and matches a specific person only.
It is sad the Capsule.body_index_map uses indexes instead of body_ids. Otherwise, we could have used a dict to store the body_skeleton without having Capsule.body_ids
Do you think we should save the capsule usage by replacing the body_id numpy array with a tuple?
This tuple would be created without having to malloc and free in the c extension (see here: https://stackoverflow.com/a/55987196).
It's just an idea, let me know if you think it would be faster this way.
Any ideas when this will make it to master?
It's not my top priority right now. If you absolutely need this branch and the newer features in dev/master, I'll try to find some time to work on it.
It's not my top priority right now. If you absolutely need this branch and the newer features in dev/master, I'll try to find some time to work on it.
Yup. I needed the body tracking sdk for python. I'm trying to build something on top of it which will run on linux, hence needed this capability.
@lpasselin please find some time to work on it, I also need this capability, currently using @nathantsoi 's branch
@lpasselin please find some time to work on it, I also need this capability, currently using @nathantsoi 's branch
Yep, I also need this haha.
It would be great to have body tracking in the master!
In my testing, I've found that cleanup functions capsule_cleanup_body_ids and capsule_cleanup_body_data are never called.
What I found:
- no circular reference on
body_skeleton - len(gc.get_referrers(capture._body_skeleton)) == 1, as it should be
- when adding fprints to other cleanup functions, I can see that
capsule_cleanup_captureis properly called every timecapturegoes out of scope
How to reproduce:
Simply run python3 examples/pose_display_2d.py and watch process memory go up.
I don't really know why is that happening but it causes huge memory leaks (~14 MB/s if capture.body_skeleton is called on each capture and FPS is 30).
@lpasselin Can you find some time to investigate this issue please?
Edit:
I've managed to get body_ids and body_skeleton working (I've removed body_index_map as it was not working with the same 'fix'). See https://github.com/Jakub-Dv/pyk4a/tree/feature/body-tracking. I don't really know if this is the correct fix, but it works.