This commit is contained in:
Manav Rathi
2024-10-11 11:14:04 +05:30
parent f3eb0fc181
commit 6c8bec0bad
2 changed files with 8 additions and 7 deletions

View File

@@ -112,8 +112,9 @@ const computeEmbedding = async (
imageData: ImageData,
electron: ElectronMLWorker,
): Promise<Float32Array> => {
// The image pre-preprocessing happens within the model itself, using ONNX primitives. This is more
// performant and also saves us from having to reinvent (say) the antialising wheels.
// The image pre-preprocessing happens within the model itself, using ONNX
// primitives. This is more performant and also saves us from having to
// reinvent (say) the antialising wheels.
const { height, width, data: pixelData } = imageData;
const inputShape = [height, width, 4]; // [H, W, C]
return normalized(

View File

@@ -335,10 +335,9 @@ const detectFaces = async (
imageData: ImageData,
electron: ElectronMLWorker,
): Promise<YOLOFaceDetection[]> => {
// The image pre-preprocessing
// happens within the model itself, using ONNX primitives. This is more
// performant and also saves us from having to reinvent (say) the
// antialising wheels.
// The image pre-preprocessing happens within the model itself, using ONNX
// primitives. This is more performant and also saves us from having to
// reinvent (say) the antialising wheels.
const {
height: imageHeight,
width: imageWidth,
@@ -364,7 +363,8 @@ const detectFaces = async (
};
/**
* Calculate image scaling done inside ONNX model run preprocessing. Needed to correct the output.
* Calculate image scaling done inside ONNX model run preprocessing. Needed to
* correct the output.
*/
const getScaledSize = (imageWidth: number, imageHeight: number) => {
const requiredWidth = 640;