@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.js CHANGED
@@ -4611,6 +4611,7 @@
4611
4611
  * Reset detection state
4612
4612
  */
4613
4613
  resetDetectionState() {
4614
+ this.emitDebug('detection', 'Resetting detection state...');
4614
4615
  this.detectionState.reset();
4615
4616
  this.actualVideoWidth = 0;
4616
4617
  this.actualVideoHeight = 0;
@@ -4779,10 +4780,35 @@
4779
4780
  const screenResult = this.detectionState.screenDetector.detectAuto(bgrFace, grayFace);
4780
4781
  // 屏幕捕获检测器已经准备就绪,其验证结果可信
4781
4782
  if (screenResult.isScreenCapture) {
4783
+ // 从 executedMethods 提取各检测器的置信度
4784
+ const methodConfidences = screenResult.executedMethods.reduce((acc, method) => {
4785
+ if (method.method.includes('Moiré')) {
4786
+ acc.moireConfidence = method.confidence;
4787
+ }
4788
+ else if (method.method.includes('Color')) {
4789
+ acc.colorConfidence = method.confidence;
4790
+ }
4791
+ else if (method.method.includes('RGB')) {
4792
+ acc.rgbConfidence = method.confidence;
4793
+ }
4794
+ return acc;
4795
+ }, {});
4782
4796
  this.emitDetectorInfo({ code: exports.DetectionCode.FACE_NOT_REAL, message: screenResult.getMessage(), screenConfidence: screenResult.confidenceScore });
4783
4797
  this.emitDebug('screen-capture-detection', 'Screen capture detected - possible video replay attack', {
4784
- confidence: screenResult.confidenceScore,
4785
- minConfidence: this.options.screen_capture_confidence_threshold
4798
+ overallConfidence: screenResult.confidenceScore,
4799
+ minConfidenceThreshold: this.options.screen_capture_confidence_threshold,
4800
+ moireConfidence: methodConfidences.moireConfidence ?? 'N/A',
4801
+ colorConfidence: methodConfidences.colorConfidence ?? 'N/A',
4802
+ rgbConfidence: methodConfidences.rgbConfidence ?? 'N/A',
4803
+ detectionStrategy: screenResult.strategy,
4804
+ riskLevel: screenResult.riskLevel,
4805
+ processingTimeMs: screenResult.processingTimeMs,
4806
+ executedMethods: screenResult.executedMethods.map((m) => ({
4807
+ method: m.method,
4808
+ isScreenCapture: m.isScreenCapture,
4809
+ confidence: m.confidence
4810
+ })),
4811
+ skippedMethods: screenResult.skippedMethods
4786
4812
  }, 'warn');
4787
4813
  this.resetDetectionState();
4788
4814
  this.scheduleNextDetection(this.options.detect_error_retry_delay);