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

Feature Request: datum-to-Pose #84

Open
cleong110 opened this issue Dec 12, 2024 · 1 comment
Open

Feature Request: datum-to-Pose #84

cleong110 opened this issue Dec 12, 2024 · 1 comment

Comments

@cleong110
Copy link
Contributor

For a number of applications, it would be nice to be able to work with poses using the Pose-format library. So, given a datum, it would be ideal to be able to reconstruct the Pose format, or at least retrieve the Header to know which point is which.

Applications include

  • Visualization of the pose sequences.
  • Being able to apply pose normalization or select specific points, as in SignCLIP.
  • Ability to save off the data as .pose files

I tried a few methods for reconstructing the pose from the datum and wasn't able to figure it out. Currently, what we get when you do a tfds.load with pose="holistic", is a Tensor, without the accompanying header that explains things like fps, which point is the NOSE point, and so forth. Eventually I just edited the data loader in question to also save off .pose files.

@AmitMY
Copy link
Contributor

AmitMY commented Dec 13, 2024

I absolutely agree. it is even possible we could do it as part of the decoding of https://github.com/sign-language-processing/datasets/blob/master/sign_language_datasets/utils/features/pose_feature.py but i am not sure.

What I do, which is terrible that it is not a part of this library, is:

dataset_name = "dgs_corpus" # for example

# Dynamically import the dataset module
dataset_module = importlib.import_module(f"sign_language_datasets.datasets.{dataset_name}.{dataset_name}")

# Read the pose header from the dataset's predefined file
with open(dataset_module._POSE_HEADERS["holistic"], "rb") as buffer:
    pose_header = PoseHeader.read(BufferReader(buffer.read()))

pose_body = NumPyPoseBody(fps=float(datum["pose"]["fps"].numpy()), 
                                                      data=datum["pose"]["data"].numpy(), 
                                                      confidence=datum["pose"]["conf"].numpy())

# Construct and return the Pose object
pose = Pose(pose_header, pose_body)

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

2 participants