@sssxyd/face-liveness-detector 0.4.0-alpha.5 → 0.4.0-alpha.6

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/dist/index.esm.js CHANGED
@@ -4589,6 +4589,7 @@ class FaceDetectionEngine extends SimpleEventEmitter {
4589
4589
  * Reset detection state
4590
4590
  */
4591
4591
  resetDetectionState() {
4592
+ this.emitDebug('detection', 'Resetting detection state...');
4592
4593
  this.detectionState.reset();
4593
4594
  this.actualVideoWidth = 0;
4594
4595
  this.actualVideoHeight = 0;
@@ -4757,10 +4758,35 @@ class FaceDetectionEngine extends SimpleEventEmitter {
4757
4758
  const screenResult = this.detectionState.screenDetector.detectAuto(bgrFace, grayFace);
4758
4759
  // 屏幕捕获检测器已经准备就绪,其验证结果可信
4759
4760
  if (screenResult.isScreenCapture) {
4761
+ // 从 executedMethods 提取各检测器的置信度
4762
+ const methodConfidences = screenResult.executedMethods.reduce((acc, method) => {
4763
+ if (method.method.includes('Moiré')) {
4764
+ acc.moireConfidence = method.confidence;
4765
+ }
4766
+ else if (method.method.includes('Color')) {
4767
+ acc.colorConfidence = method.confidence;
4768
+ }
4769
+ else if (method.method.includes('RGB')) {
4770
+ acc.rgbConfidence = method.confidence;
4771
+ }
4772
+ return acc;
4773
+ }, {});
4760
4774
  this.emitDetectorInfo({ code: DetectionCode.FACE_NOT_REAL, message: screenResult.getMessage(), screenConfidence: screenResult.confidenceScore });
4761
4775
  this.emitDebug('screen-capture-detection', 'Screen capture detected - possible video replay attack', {
4762
- confidence: screenResult.confidenceScore,
4763
- minConfidence: this.options.screen_capture_confidence_threshold
4776
+ overallConfidence: screenResult.confidenceScore,
4777
+ minConfidenceThreshold: this.options.screen_capture_confidence_threshold,
4778
+ moireConfidence: methodConfidences.moireConfidence ?? 'N/A',
4779
+ colorConfidence: methodConfidences.colorConfidence ?? 'N/A',
4780
+ rgbConfidence: methodConfidences.rgbConfidence ?? 'N/A',
4781
+ detectionStrategy: screenResult.strategy,
4782
+ riskLevel: screenResult.riskLevel,
4783
+ processingTimeMs: screenResult.processingTimeMs,
4784
+ executedMethods: screenResult.executedMethods.map((m) => ({
4785
+ method: m.method,
4786
+ isScreenCapture: m.isScreenCapture,
4787
+ confidence: m.confidence
4788
+ })),
4789
+ skippedMethods: screenResult.skippedMethods
4764
4790
  }, 'warn');
4765
4791
  this.resetDetectionState();
4766
4792
  this.scheduleNextDetection(this.options.detect_error_retry_delay);