|
@@ -6,11 +6,34 @@
|
|
|
import * as faceapi from "face-api.js";
|
|
|
import { FACE_API_MODEL_PATH } from "@/constants/constants";
|
|
|
|
|
|
+const os = (function() {
|
|
|
+ const ua = navigator.userAgent.toLowerCase();
|
|
|
+ return {
|
|
|
+ isWin2K: /windows nt 5.0/.test(ua),
|
|
|
+ isXP: /windows nt 5.1/.test(ua),
|
|
|
+ isVista: /windows nt 6.0/.test(ua),
|
|
|
+ isWin7: /windows nt 6.1/.test(ua),
|
|
|
+ isWin8: /windows nt 6.2/.test(ua),
|
|
|
+ isWin81: /windows nt 6.3/.test(ua),
|
|
|
+ isWin10: /windows nt 10.0/.test(ua),
|
|
|
+ };
|
|
|
+})();
|
|
|
+
|
|
|
+// if (os.isWin7) alert("是win7");
|
|
|
+
|
|
|
+// if (os.isWin10) alert("是win10");
|
|
|
+
|
|
|
function getFaceDetectorOptions() {
|
|
|
+ let inputSize = 320;
|
|
|
+ if (os.isWin7) {
|
|
|
+ inputSize = 256; // 在win7上无bug,速度快,效果较好
|
|
|
+ } else if (os.isWin10) {
|
|
|
+ inputSize = 320; // 在win10上,效果较好
|
|
|
+ }
|
|
|
window.____hideMe =
|
|
|
window.____hideMe ||
|
|
|
new faceapi.TinyFaceDetectorOptions({
|
|
|
- inputSize: 256,
|
|
|
+ inputSize: inputSize,
|
|
|
scoreThreshold: 0.5,
|
|
|
});
|
|
|
return window.____hideMe;
|