|
@@ -69,19 +69,28 @@ async function detectTest() {
|
|
|
await new Promise(resolve => setTimeout(resolve, 3 * 1000));
|
|
|
const inputSize = inputSizeList[idx];
|
|
|
const videoEl = document.getElementById("video");
|
|
|
- const options = new faceapi.TinyFaceDetectorOptions({
|
|
|
- inputSize: inputSize,
|
|
|
- scoreThreshold: 0.5,
|
|
|
- });
|
|
|
- const result = await faceapi.detectAllFaces(videoEl, options);
|
|
|
-
|
|
|
- if (result && result.length) {
|
|
|
- console.log(`inputSize: ${inputSize} ${result.length}`);
|
|
|
- succRate[idx]++;
|
|
|
- } else {
|
|
|
- console.log(`inputSize: ${inputSize} 检测失败`);
|
|
|
+ try {
|
|
|
+ const options = new faceapi.TinyFaceDetectorOptions({
|
|
|
+ inputSize: inputSize,
|
|
|
+ scoreThreshold: 0.5,
|
|
|
+ });
|
|
|
+ const result = await faceapi.detectAllFaces(videoEl, options);
|
|
|
+
|
|
|
+ if (result && result.length >= 1) {
|
|
|
+ console.log(`inputSize: ${inputSize} ${result.length}`);
|
|
|
+ succRate[idx]++;
|
|
|
+ } else {
|
|
|
+ console.log(`inputSize: ${inputSize} 检测失败`);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(`inputSize: ${inputSize} 检测失败-异常`);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (succRate[idx] === 10) {
|
|
|
+ console.log(`inputSize: ${inputSizeList[idx]} 提前选中`);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
console.log({ succRate });
|