Identify which faces need to have distances calculated

Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
James Ketrenos 2020-01-04 15:58:25 -08:00
parent 9962041a36
commit 840178b6ae

View File

@ -143,6 +143,27 @@ faceapi.nets.ssdMobilenetv1.loadFromDisk('./models')
concurrency: maxConcurrency
});
});
}).then(() => {
console.log("Looking for face distances that need to be updated.");
return photoDB.sequelize.query("SELECT id FROM faces ORDER BY id DESC LIMIT 1", {
type: photoDB.sequelize.QueryTypes.SELECT
}
}).then((results) => {
if (!results.length) {
console.log("No faces exist yet to generate distances.");
return;
}
const maxId = results[0].id;
return photoDB.sequelize.query("SELECT id FROM faces WHERE lastComparedId<:maxId OR lastComparedId IS NULL", {
replacements: {
maxId: maxId
},
type: photoDB.sequelize.QueryTypes.SELECT
}).then((results) => {
console.log(`${results.length} faces need to be updated.`);
});
});
}).then(() => {
console.log("Face detection scanning completed.");
}).catch((error) => {