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

Implement holistic landmarker example #355

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

st-vinhthai
Copy link
Contributor

@st-vinhthai st-vinhthai commented Mar 22, 2024

Description

This pull request adds a new holistic landmarker API

Checklist

  • My code follows the code style of the project.
  • I have updated the documentation (if applicable).

Type of Change

Please check the relevant option below:

  • New feature (non-breaking change which adds functionality)

Screenshots

Screenshot_1711093566

Copy link

google-cla bot commented Mar 22, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@PaulTR PaulTR mentioned this pull request Mar 25, 2024
3 tasks
@PaulTR
Copy link
Collaborator

PaulTR commented Mar 25, 2024

UI comment: the peek window height should be adjusted. We don't need to show the inference time below the expanding arrow until the developer has expanded the bottom sheet.

@PaulTR
Copy link
Collaborator

PaulTR commented Mar 25, 2024

UI: If the blendshapes option is off, let's hide the blendshapes '--' empty adapter

helperState.value?.minHandLandmarkThreshold ?: 0f
helperState.value =
helperState.value?.copy(
minHandLandmarkThreshold = ((currentLandmarkConfidence.toBigDecimal() + confidence.toBigDecimal()).toFloat()).coerceIn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's set all options to range from a minimum of 0.3f to a max of 0.9f.

@PaulTR
Copy link
Collaborator

PaulTR commented Mar 25, 2024

Edit: just saw the email about the segmentation crash, so sending it to eng to verify.

@PaulTR
Copy link
Collaborator

PaulTR commented Mar 25, 2024

Does this API support more than 1 person at a time? If so, we should give the dev an option to view 1-3 different poses.

@PaulTR
Copy link
Collaborator

PaulTR commented Mar 25, 2024

@schmidt-sebastian I am seeing a lot of "Replacing 305 out of 305 node(s) with delegate (unknown) node, yielding 1 partitions for the whole graph." in our logs, though numbers vary. Is this expected? I also noticed pose detection completely fails if a face isn't detected (even when I lower the face detection threshold to 0)

)
}

fun setMinPoseLandmarkConfidence(confidence: Float) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make sure we include comments for these functions to denote what they do. Similar to what we've done in other examples (https://github.com/googlesamples/mediapipe/blob/main/examples/pose_landmarker/android/app/src/main/java/com/google/mediapipe/examples/poselandmarker/PoseLandmarkerHelper.kt) so devs can read through comments along with the actual code.

private var categories: MutableList<Category?> = MutableList(52) { null }

fun updateResults(faceLandmarkerResult: HolisticLandmarkerResult? = null) {
categories = MutableList(52) { null }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's only display the top three rather than all 52.

facePaint.strokeWidth = LANDMARK_STROKE_WIDTH
facePaint.style = Paint.Style.STROKE

handPaint.color =
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're making both hands the same color, the R.color value doesn't need to be 'right hand'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be better if we separate left and right hand into two different colors, i have pushed commit to implement this.
Does this match with our expectations?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That sounds good to me!

val currentLandmarkConfidence =
helperState.value?.minFacePresenceThreshold ?: 0f
helperState.value = helperState.value?.copy(
minFacePresenceThreshold = ((currentLandmarkConfidence.toBigDecimal() + confidence.toBigDecimal()).toFloat()).coerceIn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

'set min facelandmarker confidence' shouldn't accept a delta - a set should set the value to whatever is passed to it. Let's only pass in the new value to these methods and set it rather than using the addition logic.

}
}

// Update UI after face have been detected. Extracts original
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment is a copy/paste from face landmarker. Should update to reflect what actually triggers the action.

@st-vinhthai
Copy link
Contributor Author

st-vinhthai commented Apr 1, 2024

Does this API support more than 1 person at a time? If so, we should give the dev an option to view 1-3 different poses.

@PaulTR I'm afraid not, our detecting API only return one person at a time.

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.

None yet

2 participants