Variable name changes, setting .rawCoords only if necessary

pull/70/head
ButzYung 2020-12-23 00:33:11 +08:00 committed by Vladimir Mandic
parent 95bbeb1146
commit ad3dd30fa0
3 changed files with 10 additions and 10 deletions

View File

@ -17,7 +17,7 @@ class MediaPipeFaceMesh {
if (prediction.isDisposedInternal) continue; // guard against disposed tensors on long running operations such as pause in middle of processing
const mesh = prediction.coords ? prediction.coords.arraySync() : null;
// AT: mesh_raw
const mesh_raw = prediction.rawCoords;
const meshRaw = prediction.rawCoords;
const annotations = {};
if (mesh && mesh.length > 0) {
for (let key = 0; key < coords.MESH_ANNOTATIONS.length; key++) {
@ -27,7 +27,7 @@ class MediaPipeFaceMesh {
}
}
// AT: raw version of box, the same as the TFJS Facemesh output version (.boundingBox)
const box_raw = (config.face.mesh.requestRawData && prediction.box) ? {topLeft: prediction.box.startPoint, bottomRight: prediction.box.endPoint} : null;
const boxRaw = (config.face.mesh.returnRawData && prediction.box) ? {topLeft: prediction.box.startPoint, bottomRight: prediction.box.endPoint} : null;
const box = prediction.box ? [
Math.max(0, prediction.box.startPoint[0]),
@ -40,9 +40,9 @@ class MediaPipeFaceMesh {
confidence: prediction.confidence || 0,
box,
mesh,
// AT: box_raw, mesh_raw
box_raw,
mesh_raw,
// AT: boxRaw, meshRaw
boxRaw,
meshRaw,
annotations,
image: prediction.image ? tf.clone(prediction.image) : null,
});

View File

@ -244,13 +244,13 @@ class Pipeline {
const transformedCoords = tf.tensor2d(transformedCoordsData);
const prediction = {
coords: transformedCoords,
// AT: rawCoords
rawCoords: (config.face.mesh.requestRawData) ? rawCoords : null,
box: landmarksBox,
faceConfidence: confidenceVal,
confidence: box.confidence,
image: face,
};
// AT: rawCoords
if (config.face.mesh.returnRawData) prediction.rawCoords = rawCoords;
// AT: preserve aspect ratio, pulled from Facemesh upstream
this.storedBoxes[i] = { ...squarifiedLandmarksBox, landmarks: transformedCoords.arraySync(), confidence: box.confidence, faceConfidence: confidenceVal };
// this.storedBoxes[i] = { ...landmarksBox, landmarks: transformedCoords.arraySync(), confidence: box.confidence, faceConfidence: confidenceVal };

View File

@ -291,9 +291,9 @@ class Human {
confidence: face.confidence,
box: face.box,
mesh: face.mesh,
// AT: box_raw, mesh_raw
box_raw: face.box_raw,
mesh_raw: face.mesh_raw,
// AT: boxRaw, meshRaw
boxRaw: face.boxRaw,
meshRaw: face.meshRaw,
annotations: face.annotations,
age: ageRes.age,
gender: genderRes.gender,