Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove more tf

Manav Rathie7902c5d8347
diff --git a/web/apps/photos/src/utils/machineLearning/faceAlign.ts b/web/apps/photos/src/utils/machineLearning/faceAlign.ts
index 3b8918dac7..b5117d4b00 100644
--- a/web/apps/photos/src/utils/machineLearning/faceAlign.ts
+++ b/web/apps/photos/src/utils/machineLearning/faceAlign.ts
@@ -1,17 +1,8 @@
-import * as tf from "@tensorflow/tfjs-core";
-import { Matrix, inverse } from "ml-matrix";
+import { Matrix } from "ml-matrix";
import { getSimilarityTransformation } from "similarity-transformation";
import { Dimensions } from "types/image";
import { FaceAlignment, FaceDetection } from "types/machineLearning";
import { cropWithRotation, transform } from "utils/image";
-import {
- computeRotation,
- enlargeBox,
- extractFaces,
- getBoxCenter,
- getBoxCenterPt,
- toTensor4D,
-} from ".";
import { Box, Point } from "../../../thirdparty/face-api/classes";
export function normalizeLandmarks(
@@ -97,40 +88,6 @@ export function getArcfaceAlignment(
);
}
-export function extractFaceImage(
- image: tf.Tensor4D,
- alignment: FaceAlignment,
- faceSize: number,
-) {
- const affineMat = new Matrix(alignment.affineMatrix);
-
- const I = inverse(affineMat);
-
- return tf.tidy(() => {
- const projection = tf.tensor2d([
- [
- I.get(0, 0),
- I.get(0, 1),
- I.get(0, 2),
- I.get(1, 0),
- I.get(1, 1),
- I.get(1, 2),
- 0,
- 0,
- ],
- ]);
- const faceImage = tf.image.transform(
- image,
- projection,
- "bilinear",
- "constant",
- 0,
- [faceSize, faceSize],
- );
- return faceImage;
- });
-}
-
export function getAlignedFaceBox(alignment: FaceAlignment) {
return new Box({
x: alignment.center.x - alignment.size / 2,