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

Make flipped an alias for flipHorizontal #127

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

ziyuan-linn
Copy link
Member

This PR adds flipped as an alias for flipHorizontal.

  • Adds alias feature to handleOptions function. An alias property can now be provided to the moldObject, which sets an alias name for an option.
  • Changes the mold objects of handPose, faceMesh, bodyPose, and bodySegmentation to include flipped as an alias for flipHorizontal.

TODO:
The MoveNet model does not support a flipHorizontal option natively. For MoveNet, we could try to flip the key-points in ml5 when flipped or flipHorizontal is set to true.

@ziyuan-linn ziyuan-linn linked an issue Apr 22, 2024 that may be closed by this pull request
@shiffman
Copy link
Member

This is great @ziyuan-linn! Shall we add it to the examples (or a selection of examples)? I think it might be nice for the examples, for the most part, to flip the video by default?

@ziyuan-linn
Copy link
Member Author

I agree that the examples should have flipped videos by default when possible!

@shiffman
Copy link
Member

Great! I'm going to go ahead and merge this and open an new issue to track adding flipped to the examples.

@jackbdu
Copy link

jackbdu commented Jul 18, 2024

@ziyuan-linn Thank you for adding this alias! This works perfectly fine for faceMesh and handPose, but neither { flipped: true } nor { flipHorizontal: true } works for blazePose bodyPose. Can you take a look what might be the issue?

@ziyuan-linn
Copy link
Member Author

@jackbdu Thank you for letting me know about this issue!

Looks like the filpHorizontal feature for pose-detection was never implemented by TFJS.

I am happy to implement this on ml5.js's end and update you.

@jackbdu
Copy link

jackbdu commented Jul 18, 2024

@ziyuan-linn Thank you! That would be great, especially considering it is supported in all other models!

In the repo you linked to, I found that mediapipe BlazePose supports flipHorizontal, but it is the only one that does. I wonder if the tensorflow team would be willing to implement it as well.

@ziyuan-linn ziyuan-linn mentioned this pull request Jul 18, 2024
@ziyuan-linn
Copy link
Member Author

@jackbdu Thank you for the information!

I made PR #174 to address this issue, along with some other bugs I found in the process 😂. Please feel free to give any suggestions.

Reaching out to the TFJS team might also be a good idea!

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.

Testing new p5 mirror function
3 participants