Identify which faces need to have distances calculated
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
9962041a36
commit
840178b6ae
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user