Internal change

PiperOrigin-RevId: 535131938
This commit is contained in:
Sebastian Schmidt 2023-05-24 23:42:59 -07:00 committed by Copybara-Service
parent 7800d238e9
commit 1baf72e46b
2 changed files with 14 additions and 12 deletions

View File

@ -59,7 +59,11 @@ const DEFAULT_SCORE_THRESHOLD = 0.5;
* This API expects a pre-trained face landmarker model asset bundle.
*/
export class FaceLandmarker extends VisionTaskRunner {
private result: FaceLandmarkerResult = {faceLandmarks: []};
private result: FaceLandmarkerResult = {
faceLandmarks: [],
faceBlendshapes: [],
facialTransformationMatrixes: []
};
private outputFaceBlendshapes = false;
private outputFacialTransformationMatrixes = false;
@ -256,13 +260,11 @@ export class FaceLandmarker extends VisionTaskRunner {
}
private resetResults(): void {
this.result = {faceLandmarks: []};
if (this.outputFaceBlendshapes) {
this.result.faceBlendshapes = [];
}
if (this.outputFacialTransformationMatrixes) {
this.result.facialTransformationMatrixes = [];
}
this.result = {
faceLandmarks: [],
faceBlendshapes: [],
facialTransformationMatrixes: []
};
}
/** Sets the default values for the graph. */
@ -286,7 +288,7 @@ export class FaceLandmarker extends VisionTaskRunner {
/** Adds new blendshapes from the given proto. */
private addBlenshape(data: Uint8Array[]): void {
if (!this.result.faceBlendshapes) {
if (!this.outputFaceBlendshapes) {
return;
}
@ -300,7 +302,7 @@ export class FaceLandmarker extends VisionTaskRunner {
/** Adds new transformation matrixes from the given proto. */
private addFacialTransformationMatrixes(data: Uint8Array[]): void {
if (!this.result.facialTransformationMatrixes) {
if (!this.outputFacialTransformationMatrixes) {
return;
}

View File

@ -29,8 +29,8 @@ export declare interface FaceLandmarkerResult {
faceLandmarks: NormalizedLandmark[][];
/** Optional face blendshapes results. */
faceBlendshapes?: Classifications[];
faceBlendshapes: Classifications[];
/** Optional facial transformation matrix. */
facialTransformationMatrixes?: Matrix[];
facialTransformationMatrixes: Matrix[];
}