face-api.js
Advanced tools
Comparing version 0.16.0 to 0.16.1
@@ -69,7 +69,15 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var faceDetections, faceDetectionWithHighestScore; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, new DetectAllFacesTask(this.input, this.options)]; | ||
case 1: return [2 /*return*/, (_a.sent()) | ||
.sort(function (f1, f2) { return f1.score - f2.score; })[0]]; | ||
case 1: | ||
faceDetections = _a.sent(); | ||
faceDetectionWithHighestScore = faceDetections[0]; | ||
faceDetections.forEach(function (faceDetection) { | ||
if (faceDetection.score > faceDetectionWithHighestScore.score) { | ||
faceDetectionWithHighestScore = faceDetection; | ||
} | ||
}); | ||
return [2 /*return*/, faceDetectionWithHighestScore]; | ||
} | ||
@@ -76,0 +84,0 @@ }); |
@@ -67,7 +67,15 @@ import * as tslib_1 from "tslib"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var faceDetections, faceDetectionWithHighestScore; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, new DetectAllFacesTask(this.input, this.options)]; | ||
case 1: return [2 /*return*/, (_a.sent()) | ||
.sort(function (f1, f2) { return f1.score - f2.score; })[0]]; | ||
case 1: | ||
faceDetections = _a.sent(); | ||
faceDetectionWithHighestScore = faceDetections[0]; | ||
faceDetections.forEach(function (faceDetection) { | ||
if (faceDetection.score > faceDetectionWithHighestScore.score) { | ||
faceDetectionWithHighestScore = faceDetection; | ||
} | ||
}); | ||
return [2 /*return*/, faceDetectionWithHighestScore]; | ||
} | ||
@@ -74,0 +82,0 @@ }); |
{ | ||
"name": "face-api.js", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"description": "JavaScript API for face detection and face recognition in the browser with tensorflow.js", | ||
@@ -5,0 +5,0 @@ "module": "./build/es6/index.js", |
@@ -61,4 +61,10 @@ import { TNetInput } from 'tfjs-image-recognition-base'; | ||
public async run(): Promise<FaceDetection | undefined> { | ||
return (await new DetectAllFacesTask(this.input, this.options)) | ||
.sort((f1, f2) => f1.score - f2.score)[0] | ||
const faceDetections = await new DetectAllFacesTask(this.input, this.options); | ||
let faceDetectionWithHighestScore = faceDetections[0]; | ||
faceDetections.forEach(faceDetection => { | ||
if (faceDetection.score > faceDetectionWithHighestScore.score) { | ||
faceDetectionWithHighestScore = faceDetection; | ||
} | ||
}); | ||
return faceDetectionWithHighestScore; | ||
} | ||
@@ -65,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
3661644
21225