Skip to content

Commit

Permalink
lowered bounding box threshold from 0.2 to 0.01
Browse files Browse the repository at this point in the history
  • Loading branch information
jlcvolleyball committed Feb 24, 2024
1 parent 80f893e commit 26644ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion FaceDemo/public/js/outputs/ResultOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ResultOutput extends Output {
let result = await faceapi.detectAllFaces(this._feed, new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold }))
const bboxes = await faceapi.nets.tinyFaceDetector.getBboxes(this._feed, new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold }));
let scores = bboxes[0];
// console.log(scores)
let boxes = bboxes[1];
const colors = ['red', 'green', 'cyan', 'yellow', 'magenta'];

Expand All @@ -45,14 +46,15 @@ class ResultOutput extends Output {
ctx.strokeRect(i * 64, j * 64, 64, 64);
for (let k = 0; k < 5; k++) {
const score = scores[i][j][k];
if (score > 0.2) {
if (score > 0.01) {
const box = boxes[i][j][k];
const x = box[0] * this._feed.width;
const y = box[1] * this._feed.height;
const w = box[2] * this._feed.width;
const h = box[3] * this._feed.height;
ctx.lineWidth = Math.floor(score * 10);
ctx.strokeStyle = colors[k];
console.log("k value: " + k)
ctx.strokeRect(x, y, w, h);
ctx.lineWidth = 4;
ctx.strokeRect(x + w / 2, y + h / 2, 4, 4);
Expand Down

0 comments on commit 26644ab

Please sign in to comment.