Skip to content

fix(vision): remove deprecated emotion fields from face detection samples - #10400

Open
bibliofilo wants to merge 5 commits into
GoogleCloudPlatform:mainfrom
bibliofilo:fix-vision-emotion-deprecation
Open

bibliofilo wants to merge 5 commits into
GoogleCloudPlatform:mainfrom
bibliofilo:fix-vision-emotion-deprecation

Conversation

@bibliofilo

@bibliofilo bibliofilo commented Dec 1, 2026 •

Copy link
Copy Markdown

Description

Removes joyLikelihood, sorrowLikelihood, angerLikelihood, and surpriseLikelihood from face detection samples (DetectFacesGcs.java and DetectFaces.java) and corresponding tests. Replaces the removed attributes with active likelihood fields: headwear, under exposed, and blurred.

Emotion recognition attributes in Cloud Vision API Face Detection were deprecated on October 15, 2026, and permanently return UNKNOWN.

Fixes: b/592146954

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

Compliance & Style

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample

Post-Approval Actions

  • Please merge this PR for me once it is approved

@bibliofilo
bibliofilo requested review from a team and yoshi-approver as code owners December 1, 2026 21:17
@product-auto-label product-auto-label Bot added api: vision Issues related to the Cloud Vision API. samples Issues that are directly related to samples. labels Dec 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the face detection snippets and integration tests to extract and assert headwear, under-exposed, and blurred likelihoods instead of anger, joy, and surprise. However, a critical syntax error was introduced in both DetectFaces.java and DetectFacesGcs.java due to an extra closing parenthesis after annotation.getUnderExposedLikelihood(), which will prevent compilation. The review comments correctly identify these syntax errors and provide the necessary code suggestions to resolve them.

Comment on lines +69 to 73
"headwear: %s%nunder exposed: %s%nblurred: %s%nposition: %s",
annotation.getHeadwearLikelihood(),
annotation.getUnderExposedLikelihood()),
annotation.getBlurredLikelihood(),
annotation.getBoundingPoly());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

There is a syntax error due to an extra closing parenthesis after annotation.getUnderExposedLikelihood(). This will cause a compilation failure. Please remove the extra parenthesis.

Suggested change
"headwear: %s%nunder exposed: %s%nblurred: %s%nposition: %s",
annotation.getHeadwearLikelihood(),
annotation.getUnderExposedLikelihood()),
annotation.getBlurredLikelihood(),
annotation.getBoundingPoly());
"headwear: %s%nunder exposed: %s%nblurred: %s%nposition: %s",
annotation.getHeadwearLikelihood(),
annotation.getUnderExposedLikelihood(),
annotation.getBlurredLikelihood(),
annotation.getBoundingPoly());

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, applied.

…ctFaces.java

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vision Issues related to the Cloud Vision API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant