@sssxyd/face-liveness-detector 0.4.0-alpha.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +118 -144
- package/README.md +23 -49
- package/dist/index.esm.js +3172 -2315
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3172 -2315
- package/dist/index.js.map +1 -1
- package/dist/types/browser_utils.d.ts +3 -3
- package/dist/types/browser_utils.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/dlp-color-wheel-detector.d.ts +76 -0
- package/dist/types/dlp-color-wheel-detector.d.ts.map +1 -0
- package/dist/types/face-detection-engine.d.ts +113 -16
- package/dist/types/face-detection-engine.d.ts.map +1 -1
- package/dist/types/face-detection-state.d.ts +5 -2
- package/dist/types/face-detection-state.d.ts.map +1 -1
- package/dist/types/face-frontal-calculator.d.ts +3 -3
- package/dist/types/face-frontal-calculator.d.ts.map +1 -1
- package/dist/types/image-quality-calculator.d.ts +10 -23
- package/dist/types/image-quality-calculator.d.ts.map +1 -1
- package/dist/types/motion-liveness-detector.d.ts +34 -19
- package/dist/types/motion-liveness-detector.d.ts.map +1 -1
- package/dist/types/optical-distortion-detector.d.ts +116 -0
- package/dist/types/optical-distortion-detector.d.ts.map +1 -0
- package/dist/types/screen-capture-detector.d.ts +74 -115
- package/dist/types/screen-capture-detector.d.ts.map +1 -1
- package/dist/types/screen-corners-contour-detector.d.ts +78 -0
- package/dist/types/screen-corners-contour-detector.d.ts.map +1 -0
- package/dist/types/screen-flicker-detector.d.ts +103 -0
- package/dist/types/screen-flicker-detector.d.ts.map +1 -0
- package/dist/types/screen-moire-pattern-detect.d.ts.map +1 -1
- package/dist/types/screen-response-time-detector.d.ts +70 -0
- package/dist/types/screen-response-time-detector.d.ts.map +1 -0
- package/dist/types/screen-rgb-emission-detect.d.ts.map +1 -1
- package/dist/types/types.d.ts +9 -51
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/video-frame-collector.d.ts +111 -0
- package/dist/types/video-frame-collector.d.ts.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</tr>
|
|
32
32
|
<tr>
|
|
33
33
|
<td>🎯 <strong>全维度分析</strong><br/>质量、正对度、运动分数、屏幕检测</td>
|
|
34
|
-
<td>🛡️ <strong>多维反欺骗</strong><br
|
|
34
|
+
<td>🛡️ <strong>多维反欺骗</strong><br/>照片运动检测、屏幕时序分析、轮廓边界检测</td>
|
|
35
35
|
</tr>
|
|
36
36
|
</table>
|
|
37
37
|
|
|
@@ -54,8 +54,9 @@
|
|
|
54
54
|
| 检测模块 | 技术方案 | 说明文档 |
|
|
55
55
|
|---------|--------|--------|
|
|
56
56
|
| **人脸识别** | Human.js BlazeFace + FaceMesh | 468个面部特征点 + 表情识别 |
|
|
57
|
-
|
|
|
58
|
-
|
|
|
57
|
+
| **运动活体检测** | 6指标投票系统 | [运动检测算法](./docs/MOTION_DETECTION_ALGORITHM.md) - 光流、关键点方差、眼嘴运动、面部区域变化 |
|
|
58
|
+
| **屏幕采集检测** | 4维度时序分析 | [屏幕采集检测算法](./docs/SCREEN_CAPTURE_DETECTION_ALGORITHM.md) - 屏幕闪烁、响应时间、DLP色轮、光学畸变 |
|
|
59
|
+
| **屏幕轮廓检测** | Canny边缘+轮廓分析 | [屏幕轮廓检测算法](./docs/SCREEN_CORNERS_CONTOUR_DETECTION_ALGORITHM.md) - 单帧矩形边界检测 |
|
|
59
60
|
|
|
60
61
|
---
|
|
61
62
|
|
|
@@ -140,11 +141,11 @@ const engine = new FaceDetectionEngine({
|
|
|
140
141
|
tensorflow_backend: 'auto',
|
|
141
142
|
|
|
142
143
|
// 检测设置(建议 ≥720p,否则屏幕检测准确率下降)
|
|
143
|
-
detect_video_ideal_width:
|
|
144
|
-
detect_video_ideal_height:
|
|
144
|
+
detect_video_ideal_width: 1280,
|
|
145
|
+
detect_video_ideal_height: 720,
|
|
145
146
|
detect_video_mirror: true,
|
|
146
147
|
detect_video_load_timeout: 5000,
|
|
147
|
-
detect_frame_delay:
|
|
148
|
+
detect_frame_delay: 120,
|
|
148
149
|
|
|
149
150
|
// 采集质量要求
|
|
150
151
|
collect_min_collect_count: 3, // 最少采集 3 张人脸
|
|
@@ -159,10 +160,8 @@ const engine = new FaceDetectionEngine({
|
|
|
159
160
|
action_liveness_action_randomize: true,
|
|
160
161
|
action_liveness_verify_timeout: 60000,
|
|
161
162
|
|
|
162
|
-
//
|
|
163
|
-
motion_liveness_min_motion_score: 0.15,
|
|
163
|
+
// 防欺骗设置(运动和屏幕检测使用内置优化算法,通常无需调整)
|
|
164
164
|
motion_liveness_strict_photo_detection: false,
|
|
165
|
-
screen_capture_confidence_threshold: 0.7,
|
|
166
165
|
})
|
|
167
166
|
|
|
168
167
|
// 监听核心事件
|
|
@@ -242,16 +241,24 @@ startLivenessDetection()
|
|
|
242
241
|
| `tensorflow_wasm_path` | `string` | TensorFlow WASM 文件目录 | `undefined` |
|
|
243
242
|
| `tensorflow_backend` | `'auto' \| 'webgl' \| 'wasm'` | TensorFlow 后端引擎 | `'auto'` |
|
|
244
243
|
|
|
244
|
+
### 调试模式配置
|
|
245
|
+
|
|
246
|
+
| 选项 | 类型 | 说明 | 默认值 |
|
|
247
|
+
|-----|------|------|--------|
|
|
248
|
+
| `debug_mode` | `boolean` | 启用调试模式 | `false` |
|
|
249
|
+
| `debug_log_level` | `'info' \| 'warn' \| 'error'` | 调试日志最低级别 | `'info'` |
|
|
250
|
+
| `debug_log_stages` | `string[]` | 调试日志阶段过滤(undefined=全部) | `undefined` |
|
|
251
|
+
| `debug_log_throttle` | `number` | 调试日志节流间隔(ms) | `100` |
|
|
252
|
+
|
|
245
253
|
### 视频检测设置
|
|
246
254
|
|
|
247
255
|
| 选项 | 类型 | 说明 | 默认值 |
|
|
248
256
|
|-----|------|------|--------|
|
|
249
|
-
| `detect_video_ideal_width` | `number` | 视频宽度(像素) | `
|
|
250
|
-
| `detect_video_ideal_height` | `number` | 视频高度(像素) | `
|
|
257
|
+
| `detect_video_ideal_width` | `number` | 视频宽度(像素) | `1280` |
|
|
258
|
+
| `detect_video_ideal_height` | `number` | 视频高度(像素) | `720` |
|
|
251
259
|
| `detect_video_mirror` | `boolean` | 水平翻转视频 | `true` |
|
|
252
260
|
| `detect_video_load_timeout` | `number` | 加载超时(ms) | `5000` |
|
|
253
|
-
| `detect_frame_delay` | `number` | 帧间延迟(ms) | `
|
|
254
|
-
| `detect_error_retry_delay` | `number` | 错误重试延迟(ms) | `200` |
|
|
261
|
+
| `detect_frame_delay` | `number` | 帧间延迟(ms) | `120` |
|
|
255
262
|
|
|
256
263
|
### 人脸采集质量要求
|
|
257
264
|
|
|
@@ -290,48 +297,15 @@ startLivenessDetection()
|
|
|
290
297
|
| `action_liveness_verify_timeout` | `number` | 超时时间(ms) | `60000` |
|
|
291
298
|
| `action_liveness_min_mouth_open_percent` | `number` | 最小张嘴比例 (0-1) | `0.2` |
|
|
292
299
|
|
|
293
|
-
###
|
|
300
|
+
### 运动活体检测(防照片攻击)
|
|
294
301
|
|
|
295
302
|
| 选项 | 类型 | 说明 | 默认值 |
|
|
296
303
|
|-----|------|------|--------|
|
|
297
|
-
| `motion_liveness_min_motion_score` | `number` | 最小运动分数 (0-1) | `0.15` |
|
|
298
|
-
| `motion_liveness_min_keypoint_variance` | `number` | 最小关键点方差 (0-1) | `0.02` |
|
|
299
|
-
| `motion_liveness_frame_buffer_size` | `number` | 帧缓冲区大小 | `5` |
|
|
300
|
-
| `motion_liveness_eye_aspect_ratio_threshold` | `number` | 眨眼阈值 | `0.15` |
|
|
301
|
-
| `motion_liveness_motion_consistency_threshold` | `number` | 一致性阈值 (0-1) | `0.3` |
|
|
302
|
-
| `motion_liveness_min_optical_flow_threshold` | `number` | 最小光流幅度 (0-1) | `0.02` |
|
|
303
304
|
| `motion_liveness_strict_photo_detection` | `boolean` | 严格照片检测模式 | `false` |
|
|
304
305
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
| 选项 | 类型 | 说明 | 默认值 |
|
|
308
|
-
|-----|------|------|--------|
|
|
309
|
-
| `screen_capture_confidence_threshold` | `number` | 置信度阈值 (0-1) | `0.7` |
|
|
310
|
-
| `screen_capture_detection_strategy` | `string` | 检测策略 | `'adaptive'` |
|
|
311
|
-
| `screen_moire_pattern_threshold` | `number` | 莫尔纹阈值 (0-1) | `0.65` |
|
|
312
|
-
| `screen_moire_pattern_enable_dct` | `boolean` | 启用 DCT 分析 | `true` |
|
|
313
|
-
| `screen_moire_pattern_enable_edge_detection` | `boolean` | 启用边缘检测 | `true` |
|
|
314
|
-
|
|
315
|
-
### 屏幕色彩特征
|
|
316
|
-
|
|
317
|
-
| 选项 | 类型 | 说明 | 默认值 |
|
|
318
|
-
|-----|------|------|--------|
|
|
319
|
-
| `screen_color_saturation_threshold` | `number` | 饱和度阈值 (%) | `40` |
|
|
320
|
-
| `screen_color_rgb_correlation_threshold` | `number` | RGB相关性阈值 (0-1) | `0.75` |
|
|
321
|
-
| `screen_color_pixel_entropy_threshold` | `number` | 熵值阈值 (0-8) | `6.5` |
|
|
322
|
-
| `screen_color_gradient_smoothness_threshold` | `number` | 平滑性阈值 (0-1) | `0.7` |
|
|
323
|
-
| `screen_color_confidence_threshold` | `number` | 置信度阈值 (0-1) | `0.65` |
|
|
306
|
+
> **注意**:运动活体检测使用内置的6指标投票算法,其他参数已内置优化,无需手动配置。详见[运动检测算法文档](./docs/MOTION_DETECTION_ALGORITHM.md)。
|
|
324
307
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
| 选项 | 类型 | 说明 | 默认值 |
|
|
328
|
-
|-----|------|------|--------|
|
|
329
|
-
| `screen_rgb_low_freq_start_percent` | `number` | 低频段开始 (0-1) | `0.15` |
|
|
330
|
-
| `screen_rgb_low_freq_end_percent` | `number` | 低频段结束 (0-1) | `0.35` |
|
|
331
|
-
| `screen_rgb_energy_score_weight` | `number` | 能量权重 | `0.40` |
|
|
332
|
-
| `screen_rgb_asymmetry_score_weight` | `number` | 不同步权重 | `0.40` |
|
|
333
|
-
| `screen_rgb_difference_factor_weight` | `number` | 差异权重 | `0.20` |
|
|
334
|
-
| `screen_rgb_confidence_threshold` | `number` | 置信度阈值 (0-1) | `0.65` |
|
|
308
|
+
> **注意**:屏幕采集检测使用内置的4维度级联算法(屏幕闪烁、响应时间、DLP色轮、光学畸变)和屏幕轮廓检测,所有参数已内置优化,无需手动配置。详见[屏幕采集检测算法文档](./docs/SCREEN_CAPTURE_DETECTION_ALGORITHM.md)和[屏幕轮廓检测算法文档](./docs/SCREEN_CORNERS_CONTOUR_DETECTION_ALGORITHM.md)。
|
|
335
309
|
|
|
336
310
|
---
|
|
337
311
|
|