فهرست منبع

faceid活检:暂停face-api.js参数选择

Michael Wang 5 سال پیش
والد
کامیت
ee2be21556
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      src/features/OnlineExam/Examing/FaceTracking.vue

+ 10 - 0
src/features/OnlineExam/Examing/FaceTracking.vue

@@ -60,6 +60,7 @@ function tensorFlowWebPackStatus() {
 
 let routeId = null;
 let __inputSize = 128;
+let __isDoingFaceLiveness = false;
 
 async function detectTest() {
   const inputSizeList = [128, 160, 224, 320, 416, 512, 608];
@@ -69,6 +70,10 @@ async function detectTest() {
   for (let idx = 0; idx < inputSizeList.length; idx++) {
     for (let n = 0; n < detectTimes; n++) {
       await new Promise(resolve => setTimeout(resolve, 3 * 1000));
+      if (__isDoingFaceLiveness) {
+        console.log("正在活检,暂停实时人脸");
+        await new Promise(resolve => setTimeout(resolve, 120 * 1000));
+      }
       const inputSize = inputSizeList[idx];
       const videoEl = document.getElementById("video");
       try {
@@ -138,6 +143,11 @@ export default {
     ...globalMapGetters(["isEpcc"]),
     ...mapState(["isDoingFaceLiveness"]),
   },
+  watch: {
+    isDoingFaceLiveness: function(val) {
+      __isDoingFaceLiveness = val;
+    },
+  },
   async created() {
     routeId = "created";
     await faceapi.nets.tinyFaceDetector.load(FACE_API_MODEL_PATH);