diff --git a/web/packages/new/photos/services/ml/clip.ts b/web/packages/new/photos/services/ml/clip.ts index 9679cbe615..4c4d61456b 100644 --- a/web/packages/new/photos/services/ml/clip.ts +++ b/web/packages/new/photos/services/ml/clip.ts @@ -129,7 +129,7 @@ const convertToCLIPInput = (imageData: ImageData) => { const scale = Math.max(requiredWidth / width, requiredHeight / height); // Perform antialiasing if downscaling. - const shouldAntiAlias = scale < 0.8; + const antiAlias = scale < 0.8; const scaledWidth = Math.round(width * scale); const scaledHeight = Math.round(height * scale); @@ -150,7 +150,7 @@ const convertToCLIPInput = (imageData: ImageData) => { pixelData, width, height, - shouldAntiAlias, + antiAlias, ); clipInput[pi] = r / 255.0; clipInput[pi + cOffsetG] = g / 255.0; diff --git a/web/packages/new/photos/services/ml/image.ts b/web/packages/new/photos/services/ml/image.ts index fbac2a154d..376474e407 100644 --- a/web/packages/new/photos/services/ml/image.ts +++ b/web/packages/new/photos/services/ml/image.ts @@ -321,7 +321,10 @@ const gaussianKernelRadius = Math.floor(gaussianKernelSize / 2); const gaussianSigma = 10.0; const create2DGaussianKernel = (size: number, sigma: number): number[][] => { - const kernel = Array(size).map(() => Array(size).fill(0) as number[]); + const kernel = Array(size) + .fill(0) + .map(() => Array(size).fill(0) as number[]); + let sum = 0.0; const center = Math.floor(size / 2); @@ -337,7 +340,7 @@ const create2DGaussianKernel = (size: number, sigma: number): number[][] => { } } - // Normalize the kernel + // Normalize the kernel. for (let y = 0; y < size; y++) { for (let x = 0; x < size; x++) { kernel[y]![x]! /= sum;