Limit faces to only those with confidence > 0.9
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
23c43a8fd6
commit
1b32b1ea7c
@ -147,6 +147,8 @@ long int chainLength(FaceLink *pLink) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long int maxPts = 0;
|
||||||
|
|
||||||
long int DBSCAN(Face **ppFaces, long int faceCount, double eps, int minPts) {
|
long int DBSCAN(Face **ppFaces, long int faceCount, double eps, int minPts) {
|
||||||
long int C = 0;
|
long int C = 0;
|
||||||
for (long int i = 0; i < faceCount; i++) {
|
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);
|
FaceLink *pNeighbors = RangeQuery(ppFaces, faceCount, pFace, eps);
|
||||||
long neighborCount = chainLength(pNeighbors);
|
long neighborCount = chainLength(pNeighbors);
|
||||||
|
if (neighborCount > maxPts) {
|
||||||
|
maxPts = neighborCount;
|
||||||
|
fprintf(stderr, "New max with id %ld: %ld\n", pFace->faceId, maxPts);
|
||||||
|
}
|
||||||
if (neighborCount < minPts) {
|
if (neighborCount < minPts) {
|
||||||
pFace->clusterType = NOISE;
|
pFace->clusterType = NOISE;
|
||||||
freeChain(pNeighbors);
|
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);
|
FaceLink *pSubNeighbors = RangeQuery(ppFaces, faceCount, pQ, eps);
|
||||||
neighborCount = chainLength(pSubNeighbors);
|
neighborCount = chainLength(pSubNeighbors);
|
||||||
if (neighborCount >= minPts) {
|
if (neighborCount >= minPts) {
|
||||||
|
if (neighborCount > maxPts) {
|
||||||
|
maxPts = neighborCount;
|
||||||
|
fprintf(stderr, "New max with id %ld: %ld\n", pFace->faceId, maxPts);
|
||||||
|
}
|
||||||
pQ->clusterType = CORE;
|
pQ->clusterType = CORE;
|
||||||
/* Append these neighbors to the end of the chain */
|
/* Append these neighbors to the end of the chain */
|
||||||
FaceLink *pTmp = pLink;
|
FaceLink *pTmp = pLink;
|
||||||
@ -291,7 +301,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
if (count % 1000 == 0) {
|
if (count % 1000 == 0) {
|
||||||
fprintf(stderr, "...read %ld...\n", count);
|
fprintf(stderr, "Read %ld%% of descriptors.\n", (100 * count / entries));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(faceDir);
|
closedir(faceDir);
|
||||||
|
@ -155,7 +155,7 @@ require("./db/photos").then(function(db) {
|
|||||||
const image = await canvas.loadImage(picturesPath + photoPath);
|
const image = await canvas.loadImage(picturesPath + photoPath);
|
||||||
const detections = await faceapi.detectAllFaces(image,
|
const detections = await faceapi.detectAllFaces(image,
|
||||||
new faceapi.SsdMobilenetv1Options({
|
new faceapi.SsdMobilenetv1Options({
|
||||||
minConfidence: 0.8
|
minConfidence: 0.9
|
||||||
})
|
})
|
||||||
).withFaceLandmarks();
|
).withFaceLandmarks();
|
||||||
|
|
||||||
|
@ -159,9 +159,9 @@ require("./db/photos").then(function(db) {
|
|||||||
console.log(`Loading ${file}...`);
|
console.log(`Loading ${file}...`);
|
||||||
id = undefined;
|
id = undefined;
|
||||||
loader = canvas.loadImage(picturesPath + file).then(async (image) => {
|
loader = canvas.loadImage(picturesPath + file).then(async (image) => {
|
||||||
const detectors = await faceapi.detectAllFaces(image,
|
const detectors = await faceapi.detectAllFaces(image,
|
||||||
new faceapi.SsdMobilenetv1Options({
|
new faceapi.SsdMobilenetv1Options({
|
||||||
minConfidence: 0.8
|
minConfidence: 0.9
|
||||||
})
|
})
|
||||||
).withFaceLandmarks();
|
).withFaceLandmarks();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user