react-native-vision-camera-spoof-detector 1.2.11 → 1.3.1
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.md
CHANGED
|
@@ -184,7 +184,7 @@ interface FaceAntiSpoofingResult {
|
|
|
184
184
|
|
|
185
185
|
The detector considers only one eligible face per frame. Android uses ML Kit; iOS uses Apple Vision. Both require a sufficiently large face, face landmarks, a near-frontal pose, and a face inside the frame margin. The model input is a square face crop aligned to the eyes. Frames rejected for brightness, face count, or score thresholds clear the consecutive-live-frame evidence.
|
|
186
186
|
|
|
187
|
-
`onFacesDetected` is optional and receives eligible faces as `{ bounds: { x, y, width, height } }`. `onResult` receives numeric scores only.
|
|
187
|
+
`onFacesDetected` is optional and receives eligible faces as `{ bounds: { x, y, width, height } }`. `onResult` receives numeric scores only.use the scores and your own calibrated policy. `onStableFaceDetected` is the positive event that the configured face-stability and consecutive-live-frame gates passed, and receives the face bounds and latest scores. This event is not a guarantee against presentation attacks.
|
|
188
188
|
|
|
189
189
|
Default output options on both platforms:
|
|
190
190
|
|
|
@@ -193,7 +193,7 @@ Default output options on both platforms:
|
|
|
193
193
|
| `antispoofLevel` | `0.4` | Minimum confidence for a frame to count toward the live-frame streak |
|
|
194
194
|
| `stableFrames` | `3` | Eligible face frames required before stable-face notification |
|
|
195
195
|
| `requiredLiveFrames` | `3` | Consecutive score-passing frames required before notification |
|
|
196
|
-
| `laplacianThreshold` | `
|
|
196
|
+
| `laplacianThreshold` | `1500` | Minimum Laplacian score for a frame to pass |
|
|
197
197
|
| `maxNeuralSpoofScore` | `0.1` | Neural scores at or above this value fail the liveness gate |
|
|
198
198
|
| `uiUpdateIntervalMs` | `100` | Minimum interval between score/face updates when the eligible face count is unchanged |
|
|
199
199
|
| `targetResolution` | Camera-selected | Optional requested analysis resolution |
|
|
@@ -236,8 +236,7 @@ Returns `boolean`.
|
|
|
236
236
|
|
|
237
237
|
### `FaceAntiSpoofingResult`
|
|
238
238
|
|
|
239
|
-
The score object delivered to `onResult` and `onStableFaceDetected` has the four numeric fields shown under [`useFaceAntiSpoofFrameOutput`](#usefaceantispoofframeoutputoptions).
|
|
240
|
-
|
|
239
|
+
The score object delivered to `onResult` and `onStableFaceDetected` has the four numeric fields shown under [`useFaceAntiSpoofFrameOutput`](#usefaceantispoofframeoutputoptions).
|
|
241
240
|
Result fields:
|
|
242
241
|
|
|
243
242
|
- `neuralNetworkScore`: raw model score from the TFLite classifier
|
package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt
CHANGED
|
@@ -67,7 +67,7 @@ class HybridSpoofDetectorOutput(
|
|
|
67
67
|
private val antispoofLevel = options.antispoofLevel ?: 0.4
|
|
68
68
|
private val stableFrames = (options.stableFrames ?: 3.0).toInt().coerceAtLeast(1)
|
|
69
69
|
private val requiredLiveFrames = (options.requiredLiveFrames ?: 3.0).toInt().coerceAtLeast(1)
|
|
70
|
-
private val laplacianThreshold = options.laplacianThreshold ?:
|
|
70
|
+
private val laplacianThreshold = options.laplacianThreshold ?: 1500.0
|
|
71
71
|
private val maxNeuralSpoofScore = options.maxNeuralSpoofScore ?: 0.1
|
|
72
72
|
private val uiUpdateIntervalMs = (options.uiUpdateIntervalMs ?: 100.0).toLong().coerceAtLeast(0L)
|
|
73
73
|
private val isLowRamDevice by lazy {
|
package/index.d.ts
CHANGED
|
@@ -70,8 +70,6 @@ export interface SpoofDetectedFace {
|
|
|
70
70
|
* Anti-spoofing detection state
|
|
71
71
|
*/
|
|
72
72
|
export interface AntiSpoofState {
|
|
73
|
-
/** Whether face is detected as live */
|
|
74
|
-
isLive: boolean;
|
|
75
73
|
/** Confidence score (0.0-1.0) */
|
|
76
74
|
confidence: number;
|
|
77
75
|
/** Consecutive frames detected as live */
|
|
@@ -146,7 +144,6 @@ export interface FacesUpdateData {
|
|
|
146
144
|
* Anti-spoof update callback data
|
|
147
145
|
*/
|
|
148
146
|
export interface OnAntiSpoofUpdateData {
|
|
149
|
-
isLive: boolean;
|
|
150
147
|
confidence: number;
|
|
151
148
|
rawResult?: FaceAntiSpoofingResult;
|
|
152
149
|
consecutiveLiveFrames: number;
|
|
@@ -32,7 +32,7 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
32
32
|
private var antispoofLevel: Double { options.antispoofLevel ?? 0.4 }
|
|
33
33
|
private var stableFrames: Int { max(1, Int(options.stableFrames ?? 3)) }
|
|
34
34
|
private var requiredLiveFrames: Int { max(1, Int(options.requiredLiveFrames ?? 3)) }
|
|
35
|
-
private var laplacianThreshold: Double { options.laplacianThreshold ??
|
|
35
|
+
private var laplacianThreshold: Double { options.laplacianThreshold ?? 1500 }
|
|
36
36
|
private var maxNeuralSpoofScore: Double { options.maxNeuralSpoofScore ?? 0.1 }
|
|
37
37
|
private var uiUpdateInterval: Double { max(0, options.uiUpdateIntervalMs ?? 100) / 1000 }
|
|
38
38
|
private var isLowMemoryDevice: Bool {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-vision-camera-spoof-detector",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "High-performance face anti-spoofing and liveness detection module for React Native Vision Camera. Uses TensorFlow Lite with GPU acceleration and optimized YUV processing.",
|
|
5
5
|
"homepage": "https://github.com/dpraful/react-native-vision-camera-spoof-detector",
|
|
6
6
|
"repository": {
|