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

Aaron/openpose tracking #47

Merged

Conversation

aaroncherian
Copy link
Contributor

@aaroncherian aaroncherian commented Jul 22, 2024

pulling in the openpose tracker

@aaroncherian aaroncherian requested a review from philipqueen July 22, 2024 18:30
@aaroncherian
Copy link
Contributor Author

Also something for the future is that in the subprocess call in openpose_tracker, there are flags that say --hand and --face, and we could add parameters down the line to control whether face and hand tracking is done with openpose

hand_markers = OpenPoseModelInfo.hand_markers
face_markers = OpenPoseModelInfo.face_markers
# Initialize a full array of NaNs for keypoints
keypoints_array = np.full(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some work on this class to handle the optional hand + face data better. Do we want to always return the same size array for data output (potentially with nans for hand and face data), or do we want to only include the data being tracked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing that, I was gonna tackle that sometime this week so it saves me the trouble. That's a good question, and I'm not sure I have a firm opinion. If we return the same size output, will the splitting/exporting functions down the line essentially create face/hands csvs that are empty?

Oh also I just realized, if all those emptys go into skellyforge, we may get some completely hands and face data if it tries to interpolate those completely empty arrays.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a general perspective I support only saving the data we have. Both to reduce wasting unnecessary space, and also to avoid errors like the kind you mention with skellyforge.

However, it may make some of the checks in freemocap more difficult if it's not easy to determine the expected size of the array. We would have to add some method of checking (on the freemocap side) what flags were used to process in order to verify the array is a valid shape. That will be important for multiperson work as well.

@philipqueen
Copy link
Collaborator

I did a little cleanup work on this, and once my last 3 comments are answered I think we'll be good to merge it

input_video_folder / "output_data" / "raw_data" / "openpose_jsons"
)
openpose_root_folder_path = r"C:\openpose"
output_json_path = Path(r'C:\openpose\output_json')
Copy link
Contributor Author

@aaroncherian aaroncherian Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is wrong - the we want the output jsons to be saved within the raw_data folder of the FreeMoCap recording it's running on - not the actual OpenPose demo folder.

This does bring up a point I was thinking about though. Functionally, I realized that this particular parameter shouldn't be a parameter that users change (the openpose_jsons folder should always be in the raw_data folder).

The reason this is a little tricky is because, as far as I understand, none of the other trackers we have so far need to do file saving or management during their run time processes - we pass the data back out to the process_folder_full_of_videos function to take care of that, but for OpenPose we do need to do file I/O, both to save and load the json files. So we need want a way to do some file management specific to the OpenPose tracker. Should we take a version of this code (that's in process_folder_full_of_videos):

    if output_folder_path is None:
        output_folder_path = (
            synchronized_video_path.parent / "output_data" / "raw_data" / file_name
        )
and put it in the `openpose_tracker`, but making that `openpose_jsons` folder instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a stab at implementing this. Let me know if it works and particularly if the path specified is correct (Path(input_video_filepath).parent.parent / "output_data" / "raw_data" / "openpose_jsons")

@aaroncherian
Copy link
Contributor Author

@philipqueen I fixed up a few things to get the tracker to run properly. Let me know if all seems good.

@aaroncherian aaroncherian merged commit dead477 into philip/flesh_out_mediapipe_model_info Aug 28, 2024
@aaroncherian aaroncherian deleted the aaron/openpose_tracking branch August 28, 2024 15:14
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

Successfully merging this pull request may close these issues.

2 participants