Limit faces to only those with confidence > 0.9

Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
James Ketrenos 2020-01-08 21:33:09 -08:00
parent 23c43a8fd6
commit 1b32b1ea7c
3 changed files with 14 additions and 4 deletions

View File

@ -147,6 +147,8 @@ long int chainLength(FaceLink *pLink) {
return count;
}
long int maxPts = 0;
long int DBSCAN(Face **ppFaces, long int faceCount, double eps, int minPts) {
long int C = 0;
for (long int i = 0; i < faceCount; i++) {
@ -157,6 +159,10 @@ long int DBSCAN(Face **ppFaces, long int faceCount, double eps, int minPts) {
FaceLink *pNeighbors = RangeQuery(ppFaces, faceCount, pFace, eps);
long neighborCount = chainLength(pNeighbors);
if (neighborCount > maxPts) {
maxPts = neighborCount;
fprintf(stderr, "New max with id %ld: %ld\n", pFace->faceId, maxPts);
}
if (neighborCount < minPts) {
pFace->clusterType = NOISE;
freeChain(pNeighbors);
@ -193,6 +199,10 @@ long int DBSCAN(Face **ppFaces, long int faceCount, double eps, int minPts) {
FaceLink *pSubNeighbors = RangeQuery(ppFaces, faceCount, pQ, eps);
neighborCount = chainLength(pSubNeighbors);
if (neighborCount >= minPts) {
if (neighborCount > maxPts) {
maxPts = neighborCount;
fprintf(stderr, "New max with id %ld: %ld\n", pFace->faceId, maxPts);
}
pQ->clusterType = CORE;
/* Append these neighbors to the end of the chain */
FaceLink *pTmp = pLink;
@ -291,7 +301,7 @@ int main(int argc, char *argv[]) {
}
count++;
if (count % 1000 == 0) {
fprintf(stderr, "...read %ld...\n", count);
fprintf(stderr, "Read %ld%% of descriptors.\n", (100 * count / entries));
}
}
closedir(faceDir);

View File

@ -155,7 +155,7 @@ require("./db/photos").then(function(db) {
const image = await canvas.loadImage(picturesPath + photoPath);
const detections = await faceapi.detectAllFaces(image,
new faceapi.SsdMobilenetv1Options({
minConfidence: 0.8
minConfidence: 0.9
})
).withFaceLandmarks();

View File

@ -159,9 +159,9 @@ require("./db/photos").then(function(db) {
console.log(`Loading ${file}...`);
id = undefined;
loader = canvas.loadImage(picturesPath + file).then(async (image) => {
const detectors = await faceapi.detectAllFaces(image,
const detectors = await faceapi.detectAllFaces(image,
new faceapi.SsdMobilenetv1Options({
minConfidence: 0.8
minConfidence: 0.9
})
).withFaceLandmarks();