Rename Holistic's landmarksConfidence to presenceConfidence to match other APIs better

PiperOrigin-RevId: 592607279
This commit is contained in:
Sebastian Schmidt 2023-12-20 11:05:06 -08:00 committed by Copybara-Service
parent 7edcba9fc0
commit 1fa79195ec
4 changed files with 18 additions and 18 deletions

View File

@ -479,7 +479,7 @@ public final class HolisticLandmarker extends BaseVisionTaskApi {
* Sets minimum confidence score for the face landmark detection to be considered successful. * Sets minimum confidence score for the face landmark detection to be considered successful.
* Defaults to 0.5. * Defaults to 0.5.
*/ */
public abstract Builder setMinFaceLandmarksConfidence(Float value); public abstract Builder setMinFacePresenceConfidence(Float value);
/** /**
* The minimum confidence score for the pose detection to be considered successful. Defaults * The minimum confidence score for the pose detection to be considered successful. Defaults
@ -497,7 +497,7 @@ public final class HolisticLandmarker extends BaseVisionTaskApi {
* The minimum confidence score for the pose landmarks detection to be considered successful. * The minimum confidence score for the pose landmarks detection to be considered successful.
* Defaults to 0.5. * Defaults to 0.5.
*/ */
public abstract Builder setMinPoseLandmarksConfidence(Float value); public abstract Builder setMinPosePresenceConfidence(Float value);
/** /**
* The minimum confidence score for the hand landmark detection to be considered successful. * The minimum confidence score for the hand landmark detection to be considered successful.
@ -555,13 +555,13 @@ public final class HolisticLandmarker extends BaseVisionTaskApi {
abstract Optional<Float> minFaceSuppressionThreshold(); abstract Optional<Float> minFaceSuppressionThreshold();
abstract Optional<Float> minFaceLandmarksConfidence(); abstract Optional<Float> minFacePresenceConfidence();
abstract Optional<Float> minPoseDetectionConfidence(); abstract Optional<Float> minPoseDetectionConfidence();
abstract Optional<Float> minPoseSuppressionThreshold(); abstract Optional<Float> minPoseSuppressionThreshold();
abstract Optional<Float> minPoseLandmarksConfidence(); abstract Optional<Float> minPosePresenceConfidence();
abstract Optional<Float> minHandLandmarksConfidence(); abstract Optional<Float> minHandLandmarksConfidence();
@ -578,10 +578,10 @@ public final class HolisticLandmarker extends BaseVisionTaskApi {
.setRunningMode(RunningMode.IMAGE) .setRunningMode(RunningMode.IMAGE)
.setMinFaceDetectionConfidence(DEFAULT_PRESENCE_THRESHOLD) .setMinFaceDetectionConfidence(DEFAULT_PRESENCE_THRESHOLD)
.setMinFaceSuppressionThreshold(DEFAULT_SUPPRESION_THRESHOLD) .setMinFaceSuppressionThreshold(DEFAULT_SUPPRESION_THRESHOLD)
.setMinFaceLandmarksConfidence(DEFAULT_PRESENCE_THRESHOLD) .setMinFacePresenceConfidence(DEFAULT_PRESENCE_THRESHOLD)
.setMinPoseDetectionConfidence(DEFAULT_PRESENCE_THRESHOLD) .setMinPoseDetectionConfidence(DEFAULT_PRESENCE_THRESHOLD)
.setMinPoseSuppressionThreshold(DEFAULT_SUPPRESION_THRESHOLD) .setMinPoseSuppressionThreshold(DEFAULT_SUPPRESION_THRESHOLD)
.setMinPoseLandmarksConfidence(DEFAULT_PRESENCE_THRESHOLD) .setMinPosePresenceConfidence(DEFAULT_PRESENCE_THRESHOLD)
.setMinHandLandmarksConfidence(DEFAULT_PRESENCE_THRESHOLD) .setMinHandLandmarksConfidence(DEFAULT_PRESENCE_THRESHOLD)
.setOutputFaceBlendshapes(DEFAULT_OUTPUT_FACE_BLENDSHAPES) .setOutputFaceBlendshapes(DEFAULT_OUTPUT_FACE_BLENDSHAPES)
.setOutputPoseSegmentationMasks(DEFAULT_OUTPUT_SEGMENTATION_MASKS); .setOutputPoseSegmentationMasks(DEFAULT_OUTPUT_SEGMENTATION_MASKS);
@ -616,12 +616,12 @@ public final class HolisticLandmarker extends BaseVisionTaskApi {
// Configure pose detector options. // Configure pose detector options.
minPoseDetectionConfidence().ifPresent(poseDetectorGraphOptions::setMinDetectionConfidence); minPoseDetectionConfidence().ifPresent(poseDetectorGraphOptions::setMinDetectionConfidence);
minPoseSuppressionThreshold().ifPresent(poseDetectorGraphOptions::setMinSuppressionThreshold); minPoseSuppressionThreshold().ifPresent(poseDetectorGraphOptions::setMinSuppressionThreshold);
minPoseLandmarksConfidence().ifPresent(poseLandmarkerGraphOptions::setMinDetectionConfidence); minPosePresenceConfidence().ifPresent(poseLandmarkerGraphOptions::setMinDetectionConfidence);
// Configure face detector options. // Configure face detector options.
minFaceDetectionConfidence().ifPresent(faceDetectorGraphOptions::setMinDetectionConfidence); minFaceDetectionConfidence().ifPresent(faceDetectorGraphOptions::setMinDetectionConfidence);
minFaceSuppressionThreshold().ifPresent(faceDetectorGraphOptions::setMinSuppressionThreshold); minFaceSuppressionThreshold().ifPresent(faceDetectorGraphOptions::setMinSuppressionThreshold);
minFaceLandmarksConfidence() minFacePresenceConfidence()
.ifPresent(faceLandmarksDetectorGraphOptions::setMinDetectionConfidence); .ifPresent(faceLandmarksDetectorGraphOptions::setMinDetectionConfidence);
holisticLandmarkerGraphOptions holisticLandmarkerGraphOptions

View File

@ -303,9 +303,9 @@ export class HolisticLandmarker extends VisionTaskRunner {
} }
// Configure face landmark detector options. // Configure face landmark detector options.
if ('minFaceLandmarksConfidence' in options) { if ('minFacePresenceConfidence' in options) {
this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence( this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(
options.minFaceLandmarksConfidence ?? DEFAULT_SCORE_THRESHOLD); options.minFacePresenceConfidence ?? DEFAULT_SCORE_THRESHOLD);
} }
if ('outputFaceBlendshapes' in options) { if ('outputFaceBlendshapes' in options) {
this.outputFaceBlendshapes = !!options.outputFaceBlendshapes; this.outputFaceBlendshapes = !!options.outputFaceBlendshapes;
@ -322,9 +322,9 @@ export class HolisticLandmarker extends VisionTaskRunner {
} }
// Configure pose landmark detector options. // Configure pose landmark detector options.
if ('minPoseLandmarksConfidence' in options) { if ('minPosePresenceConfidence' in options) {
this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence( this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(
options.minPoseLandmarksConfidence ?? DEFAULT_SCORE_THRESHOLD); options.minPosePresenceConfidence ?? DEFAULT_SCORE_THRESHOLD);
} }
if ('outputPoseSegmentationMasks' in options) { if ('outputPoseSegmentationMasks' in options) {
this.outputPoseSegmentationMasks = !!options.outputPoseSegmentationMasks; this.outputPoseSegmentationMasks = !!options.outputPoseSegmentationMasks;

View File

@ -34,7 +34,7 @@ export declare interface HolisticLandmarkerOptions extends VisionTaskOptions {
* The minimum confidence score of face presence score in the face landmarks * The minimum confidence score of face presence score in the face landmarks
* detection. Defaults to 0.5. * detection. Defaults to 0.5.
*/ */
minFaceLandmarksConfidence?: number|undefined; minFacePresenceConfidence?: number|undefined;
/** /**
* Whether FaceLandmarker outputs face blendshapes classification. Face * Whether FaceLandmarker outputs face blendshapes classification. Face
@ -58,7 +58,7 @@ export declare interface HolisticLandmarkerOptions extends VisionTaskOptions {
* The minimum confidence score of pose presence score in the pose landmarks * The minimum confidence score of pose presence score in the pose landmarks
* detection. Defaults to 0.5. * detection. Defaults to 0.5.
*/ */
minPoseLandmarksConfidence?: number|undefined; minPosePresenceConfidence?: number|undefined;
/** Whether to output segmentation masks. Defaults to false. */ /** Whether to output segmentation masks. Defaults to false. */
outputPoseSegmentationMasks?: boolean|undefined; outputPoseSegmentationMasks?: boolean|undefined;

View File

@ -122,10 +122,10 @@ describe('HolisticLandmarker', () => {
it('merges options', async () => { it('merges options', async () => {
await holisticLandmarker.setOptions({minFaceDetectionConfidence: 0.5}); await holisticLandmarker.setOptions({minFaceDetectionConfidence: 0.5});
await holisticLandmarker.setOptions({minFaceSuppressionThreshold: 0.5}); await holisticLandmarker.setOptions({minFaceSuppressionThreshold: 0.5});
await holisticLandmarker.setOptions({minFaceLandmarksConfidence: 0.5}); await holisticLandmarker.setOptions({minFacePresenceConfidence: 0.5});
await holisticLandmarker.setOptions({minPoseDetectionConfidence: 0.5}); await holisticLandmarker.setOptions({minPoseDetectionConfidence: 0.5});
await holisticLandmarker.setOptions({minPoseSuppressionThreshold: 0.5}); await holisticLandmarker.setOptions({minPoseSuppressionThreshold: 0.5});
await holisticLandmarker.setOptions({minPoseLandmarksConfidence: 0.5}); await holisticLandmarker.setOptions({minPosePresenceConfidence: 0.5});
await holisticLandmarker.setOptions({minHandLandmarksConfidence: 0.5}); await holisticLandmarker.setOptions({minHandLandmarksConfidence: 0.5});
verifyGraph( verifyGraph(
@ -202,7 +202,7 @@ describe('HolisticLandmarker', () => {
defaultValue: 0.3 defaultValue: 0.3
}, },
{ {
optionPath: ['minFaceLandmarksConfidence'], optionPath: ['minFacePresenceConfidence'],
fieldPath: fieldPath:
['faceLandmarksDetectorGraphOptions', 'minDetectionConfidence'], ['faceLandmarksDetectorGraphOptions', 'minDetectionConfidence'],
customValue: 0.2, customValue: 0.2,
@ -221,7 +221,7 @@ describe('HolisticLandmarker', () => {
defaultValue: 0.3 defaultValue: 0.3
}, },
{ {
optionPath: ['minPoseLandmarksConfidence'], optionPath: ['minPosePresenceConfidence'],
fieldPath: fieldPath:
['poseLandmarksDetectorGraphOptions', 'minDetectionConfidence'], ['poseLandmarksDetectorGraphOptions', 'minDetectionConfidence'],
customValue: 0.2, customValue: 0.2,