瀏覽代碼

阿里云log:实时人脸检测

Michael Wang 5 年之前
父節點
當前提交
7d6b290fb3
共有 1 個文件被更改,包括 30 次插入0 次删除
  1. 30 0
      src/features/OnlineExam/Examing/FaceTracking.vue

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

@@ -9,6 +9,7 @@ import { mapGetters as globalMapGetters } from "vuex";
 import { createNamespacedHelpers } from "vuex";
 const { mapState } = createNamespacedHelpers("examingHomeModule");
 import { isThisMachineOwnByStudent } from "@/utils/util";
+import { createLog } from "@/utils/logger";
 
 window.faceapi = faceapi;
 
@@ -98,12 +99,23 @@ async function detectTest() {
         "答题页面",
         "启动检测耗时过长:停止实时",
       ]);
+      createLog({
+        page: "实时人脸检测",
+        action: "启动检测耗时过长:停止实时",
+        result: JSON.stringify(result),
+        cost: detectStartTime - detectEndTime,
+      });
       return;
     }
   } catch (error) {
     console.log(error);
     disableFaceTracking = true;
     window._hmt.push(["_trackEvent", "答题页面", "启动检测错误:停止实时"]);
+    createLog({
+      page: "实时人脸检测",
+      action: "启动检测错误:停止实时",
+      error: JSON.stringify(error),
+    });
     return;
   }
 
@@ -139,6 +151,11 @@ async function detectTest() {
             "答题页面",
             "单次检测耗时过长:停止实时",
           ]);
+          createLog({
+            page: "实时人脸检测",
+            action: "单次检测耗时过长:停止实时",
+            cost: detectStartTime - detectEndTime,
+          });
           return;
         }
 
@@ -173,6 +190,10 @@ async function detectTest() {
     "答题页面",
     "最好的 inputSize 为: " + __inputSize,
   ]);
+  createLog({
+    page: "实时人脸检测",
+    action: "最好的 inputSize 为:" + __inputSize,
+  });
 
   return __inputSize;
 }
@@ -253,6 +274,11 @@ export default {
         this.multipleTimeUsage > 0.5 * 1000
       ) {
         console.log("关闭实时人脸检测,因为耗时过长", this.multipleTimeUsage);
+        this.logger({
+          page: "实时人脸检测",
+          action: "关闭实时人脸检测,因为耗时过长",
+          multipleTimeUsage: this.multipleTimeUsage,
+        });
         window._hmt.push([
           "_trackEvent",
           "答题页面",
@@ -262,6 +288,10 @@ export default {
       }
       if (this.isDoingFaceLiveness) {
         console.log("正在活检,暂停实时人脸");
+        this.logger({
+          page: "实时人脸检测",
+          action: "正在活检,暂停实时人脸",
+        });
         this.detectFacesTimeout = setTimeout(
           () => this.detectFaces(),
           10 * 1000