Ver código fonte

window.__inputSize 可能取不到,先别缓存

Michael Wang 5 anos atrás
pai
commit
abfb97c4c5

+ 5 - 7
src/features/OnlineExam/Examing/FaceMotion/FaceMotion.vue

@@ -172,13 +172,11 @@ window.faceapi = faceapi;
 // tiny_face_detector options
 
 function getFaceDetectorOptions() {
-  window.____hideMe =
-    window.____hideMe ||
-    new faceapi.TinyFaceDetectorOptions({
-      inputSize: window.__inputSize || 128, // 这行是解决Box.constructor - expected box to be IBoundingBox | IRect, instead have 问题的关键
-      scoreThreshold: 0.5,
-    });
-  return window.____hideMe;
+  return new faceapi.TinyFaceDetectorOptions({
+    inputSize: window.__inputSize || 128, // 这行是解决Box.constructor - expected box to be IBoundingBox | IRect, instead have 问题的关键
+    scoreThreshold: 0.5,
+  });
+
   // return new faceapi.SsdMobilenetv1Options({ minConfidence: 0.8 });
   // return new faceapi.MtcnnOptions({ minFaceSize: 200, scaleFactor: 0.8 });
 }

+ 5 - 7
src/features/OnlineExam/Examing/FaceTracking.vue

@@ -118,13 +118,11 @@ async function detectTest() {
 }
 
 function getFaceDetectorOptions() {
-  window.____hideMe =
-    window.____hideMe ||
-    new faceapi.TinyFaceDetectorOptions({
-      inputSize: __inputSize,
-      scoreThreshold: 0.5,
-    });
-  return window.____hideMe;
+  return new faceapi.TinyFaceDetectorOptions({
+    inputSize: __inputSize || 128,
+    scoreThreshold: 0.5,
+  });
+
   // return new faceapi.SsdMobilenetv1Options({ minConfidence: 0.8 });
   // return new faceapi.MtcnnOptions({ minFaceSize: 200, scaleFactor: 0.8 });
 }