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

View File

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