react-native-vision-camera-spoof-detector 1.0.7 → 1.0.8
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/android/.cxx/Debug/2a1it684/arm64-v8a/.cmake/api/v1/reply/{codemodel-v2-390962e2784a6a84fa3e.json → codemodel-v2-501c3f4eb817726556cc.json} +2 -2
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.cmake/api/v1/reply/{index-2025-11-25T14-48-56-0722.json → index-2025-11-25T16-55-22-0685.json} +2 -2
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.cmake/api/v1/reply/{target-yuv-Debug-1e27b8a2bdcddd47b87d.json → target-yuv-Debug-63fdb78450b0b16b8484.json} +4 -4
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.cmake/api/v1/reply/{target-yuv_shared-Debug-ac9194487d1fc1268a87.json → target-yuv_shared-Debug-5c8b5c6f50bc8769a5bd.json} +4 -4
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.ninja_log +124 -124
- package/android/.cxx/Debug/2a1it684/arm64-v8a/CMakeFiles/CMakeOutput.log +22 -22
- package/android/.cxx/Debug/2a1it684/arm64-v8a/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{codemodel-v2-52ac1d8b40b69596389b.json → codemodel-v2-053850119b681f93cecc.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{index-2025-11-25T14-14-30-0191.json → index-2025-11-25T16-21-43-0410.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{target-yuv-Debug-97f9e822dbd84a186d44.json → target-yuv-Debug-a12ad49ff79080871bce.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{target-yuv_shared-Debug-3730d20e27c3481c06b2.json → target-yuv_shared-Debug-2b00e64621a56b8dd632.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.ninja_log +176 -117
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/x86/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/x86/.ninja_log +164 -109
- package/android/.cxx/Debug/2a1it684/x86/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/x86/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/x86_64/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/x86_64/.ninja_log +109 -109
- package/android/.cxx/Debug/2a1it684/x86_64/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/x86_64/configure_fingerprint.bin +15 -15
- package/android/build/.transforms/4ebf3dd0dca4f83fe1776360e21ded81/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/AcceleratorConfig.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/AntiSpoofingResult.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/build_stdout_targets.txt +50 -50
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/generate_cxx_metadata_1041_timing.txt +9 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/armeabi-v7a/build_stdout_targets.txt +44 -44
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/armeabi-v7a/{generate_cxx_metadata_455_timing.txt → generate_cxx_metadata_1042_timing.txt} +1 -1
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86/build_stdout_targets.txt +34 -34
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86/{generate_cxx_metadata_455_timing.txt → generate_cxx_metadata_1042_timing.txt} +1 -1
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/build_stdout_targets.txt +38 -38
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/generate_cxx_metadata_1042_timing.txt +9 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/AcceleratorConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/AntiSpoofingResult.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/AcceleratorConfig.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/AntiSpoofingResult.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced.class +0 -0
- package/android/src/main/java/com/faceantispoof/AcceleratorConfig.kt +57 -9
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofingAdvanced.kt +115 -22
- package/package.json +1 -1
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/generate_cxx_metadata_456_timing.txt +0 -9
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/generate_cxx_metadata_455_timing.txt +0 -9
- /package/android/.cxx/Debug/2a1it684/x86/.cmake/api/v1/reply/{index-2025-11-25T14-14-37-0548.json → index-2025-11-25T16-21-51-0349.json} +0 -0
- /package/android/.cxx/Debug/2a1it684/x86_64/.cmake/api/v1/reply/{index-2025-11-25T14-49-17-0490.json → index-2025-11-25T16-55-39-0849.json} +0 -0
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced.class
CHANGED
|
Binary file
|
|
@@ -3,12 +3,14 @@ package com.faceantispoof
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration class for TensorFlow Lite accelerators
|
|
5
5
|
* Allows developers to control GPU/NNAPI delegate behavior
|
|
6
|
+
* and optimize for different device tiers (low-end, mid-range, high-end)
|
|
6
7
|
*/
|
|
7
8
|
object AcceleratorConfig {
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Enable GPU acceleration (recommended for modern devices)
|
|
11
12
|
* Accelerates model 3-10x compared to CPU
|
|
13
|
+
* GPU is automatically skipped on low-end devices even if enabled
|
|
12
14
|
*/
|
|
13
15
|
var enableGpu: Boolean = true
|
|
14
16
|
|
|
@@ -16,34 +18,80 @@ object AcceleratorConfig {
|
|
|
16
18
|
* Enable NNAPI acceleration (recommended for Pixel/Samsung devices)
|
|
17
19
|
* Accelerates model 3-10x compared to CPU
|
|
18
20
|
* Fallback if GPU is not available
|
|
21
|
+
* Works better on mid-range and high-end devices
|
|
19
22
|
*/
|
|
20
23
|
var enableNnapi: Boolean = true
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Enable CPU fallback if GPU/NNAPI are not available
|
|
24
|
-
* Default: true
|
|
27
|
+
* Default: true (always fallback to CPU)
|
|
25
28
|
*/
|
|
26
29
|
var enableCpuFallback: Boolean = true
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* Number of threads for CPU inference
|
|
30
|
-
* Default: 4 threads
|
|
33
|
+
* Default: 4 threads (optimal for most devices)
|
|
34
|
+
* Low-end devices will use 1-2 threads regardless
|
|
31
35
|
*/
|
|
32
36
|
var cpuThreadCount: Int = 4
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
39
|
+
* Force CPU-only mode for all devices
|
|
40
|
+
* Useful for debugging or if GPU/NNAPI causes issues
|
|
41
|
+
* Default: false
|
|
42
|
+
*/
|
|
43
|
+
var forceCpuOnly: Boolean = false
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Disable GPU delegate specifically
|
|
47
|
+
* Keeps NNAPI enabled if available
|
|
48
|
+
* Default: false
|
|
49
|
+
*/
|
|
50
|
+
var disableGpuDelegate: Boolean = false
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Disable NNAPI delegate specifically
|
|
54
|
+
* GPU will still be attempted if enabled
|
|
55
|
+
* Default: false
|
|
56
|
+
*/
|
|
57
|
+
var disableNnapiDelegate: Boolean = false
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Print debug logs for accelerator selection and performance
|
|
61
|
+
* Default: true
|
|
36
62
|
*/
|
|
37
63
|
var debugLogging: Boolean = true
|
|
38
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Enable aggressive optimization for low-end devices
|
|
67
|
+
* Reduces memory usage and processes fewer frames
|
|
68
|
+
* Default: true
|
|
69
|
+
*/
|
|
70
|
+
var optimizeForLowEndDevices: Boolean = true
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Maximum memory (in MB) to allocate for the interpreter
|
|
74
|
+
* Low-end devices will use less aggressive settings
|
|
75
|
+
* Default: 0 (use system defaults)
|
|
76
|
+
*/
|
|
77
|
+
var maxMemoryAllocation: Int = 0
|
|
78
|
+
|
|
39
79
|
override fun toString(): String {
|
|
40
80
|
return """
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
╔════════════════════════════════════════════════╗
|
|
82
|
+
║ TFLite Accelerator Configuration ║
|
|
83
|
+
╠════════════════════════════════════════════════╣
|
|
84
|
+
║ GPU Acceleration: $enableGpu
|
|
85
|
+
║ NNAPI Acceleration: $enableNnapi
|
|
86
|
+
║ CPU Fallback: $enableCpuFallback
|
|
87
|
+
║ CPU Threads: $cpuThreadCount
|
|
88
|
+
║ Force CPU Only: $forceCpuOnly
|
|
89
|
+
║ Disable GPU Delegate: $disableGpuDelegate
|
|
90
|
+
║ Disable NNAPI Delegate: $disableNnapiDelegate
|
|
91
|
+
║ Debug Logging: $debugLogging
|
|
92
|
+
║ Optimize Low-End: $optimizeForLowEndDevices
|
|
93
|
+
║ Max Memory (MB): $maxMemoryAllocation
|
|
94
|
+
╚════════════════════════════════════════════════╝
|
|
47
95
|
""".trimIndent()
|
|
48
96
|
}
|
|
49
97
|
}
|
|
@@ -96,22 +96,15 @@ class FaceAntiSpoofingAdvanced(private val assetManager: AssetManager) {
|
|
|
96
96
|
try {
|
|
97
97
|
val modelBuffer = loadModelFile(assetManager, MODEL_FILE)
|
|
98
98
|
val options = Interpreter.Options()
|
|
99
|
-
options.setNumThreads(4)
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Log.i(TAG, "NNAPI enabled successfully")
|
|
110
|
-
} catch (e: Exception) {
|
|
111
|
-
currentAccelerator = ACCELERATOR_CPU
|
|
112
|
-
Log.i(TAG, "Running on CPU (GPU/NNAPI not available): ${e.message}")
|
|
113
|
-
}
|
|
114
|
-
}
|
|
100
|
+
// FORCE CPU-ONLY MODE FOR LOW-END DEVICE COMPATIBILITY
|
|
101
|
+
// This bypasses all GPU/NNAPI issues and uses stable CPU inference
|
|
102
|
+
val optimalThreads = getOptimalThreadCount()
|
|
103
|
+
options.setNumThreads(optimalThreads)
|
|
104
|
+
|
|
105
|
+
currentAccelerator = ACCELERATOR_CPU
|
|
106
|
+
Log.i(TAG, "✓ FORCED CPU-ONLY MODE - Bypassing GPU/NNAPI")
|
|
107
|
+
Log.i(TAG, "Using $optimalThreads threads for CPU inference")
|
|
115
108
|
|
|
116
109
|
interpreter = Interpreter(modelBuffer, options)
|
|
117
110
|
|
|
@@ -126,28 +119,46 @@ class FaceAntiSpoofingAdvanced(private val assetManager: AssetManager) {
|
|
|
126
119
|
outputs[outputIndex0] = clssPred
|
|
127
120
|
outputs[outputIndex1] = leafNodeMask
|
|
128
121
|
isInitialized = true
|
|
129
|
-
Log.i(TAG, "
|
|
122
|
+
Log.i(TAG, "✓ Face Anti-Spoof initialized | CPU-ONLY MODE | Threads: $optimalThreads")
|
|
130
123
|
} catch (e: Exception) {
|
|
131
|
-
Log.e(TAG, "Failed to load TFLite model", e)
|
|
124
|
+
Log.e(TAG, "✗ Failed to load TFLite model: ${e.message}", e)
|
|
132
125
|
isInitialized = false
|
|
126
|
+
currentAccelerator = ACCELERATOR_CPU
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
129
|
|
|
136
130
|
private fun tryAddGpuDelegate(options: Interpreter.Options): Boolean {
|
|
137
131
|
return try {
|
|
132
|
+
// Additional check: verify device has minimum Android version for GPU delegate
|
|
133
|
+
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
|
|
134
|
+
Log.w(TAG, "GPU delegate requires Android 5.0+, device running: ${android.os.Build.VERSION.SDK_INT}")
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
|
|
138
138
|
val compatibilityList = CompatibilityList()
|
|
139
139
|
if (compatibilityList.isDelegateSupportedOnThisDevice) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
try {
|
|
141
|
+
gpuDelegate = GpuDelegate(compatibilityList.bestOptionsForThisDevice)
|
|
142
|
+
options.addDelegate(gpuDelegate)
|
|
143
|
+
Log.d(TAG, "GPU delegate added successfully")
|
|
144
|
+
true
|
|
145
|
+
} catch (e: Exception) {
|
|
146
|
+
Log.w(TAG, "Failed to initialize GPU delegate after compatibility check: ${e.message}")
|
|
147
|
+
gpuDelegate?.close()
|
|
148
|
+
gpuDelegate = null
|
|
149
|
+
false
|
|
150
|
+
}
|
|
144
151
|
} else {
|
|
145
152
|
Log.d(TAG, "GPU delegate not supported on this device")
|
|
146
153
|
false
|
|
147
154
|
}
|
|
148
155
|
} catch (e: Exception) {
|
|
149
156
|
Log.w(TAG, "Failed to add GPU delegate: ${e.message}")
|
|
150
|
-
|
|
157
|
+
try {
|
|
158
|
+
gpuDelegate?.close()
|
|
159
|
+
} catch (e2: Exception) {
|
|
160
|
+
Log.w(TAG, "Error closing GPU delegate: ${e2.message}")
|
|
161
|
+
}
|
|
151
162
|
gpuDelegate = null
|
|
152
163
|
false
|
|
153
164
|
}
|
|
@@ -772,6 +783,88 @@ class FaceAntiSpoofingAdvanced(private val assetManager: AssetManager) {
|
|
|
772
783
|
Log.e(TAG, "Error closing interpreter", e)
|
|
773
784
|
}
|
|
774
785
|
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Detects if the device is high-end based on RAM, processor, and Android version.
|
|
789
|
+
* High-end devices can use GPU/NNAPI delegates.
|
|
790
|
+
* Low-end devices default to optimized CPU inference.
|
|
791
|
+
*/
|
|
792
|
+
private fun isHighEndDevice(): Boolean {
|
|
793
|
+
try {
|
|
794
|
+
// Check Android version
|
|
795
|
+
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
|
|
796
|
+
Log.d(TAG, "Device running Android ${android.os.Build.VERSION.SDK_INT} (< 5.0) - low-end")
|
|
797
|
+
return false
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// Check available RAM
|
|
801
|
+
val runtime = Runtime.getRuntime()
|
|
802
|
+
val maxMemory = runtime.maxMemory() / (1024 * 1024) // Convert to MB
|
|
803
|
+
if (maxMemory < 256) { // Less than 256MB allocated
|
|
804
|
+
Log.d(TAG, "Low available RAM: ${maxMemory}MB - treating as low-end device")
|
|
805
|
+
return false
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// Check processor cores (devices with 2 cores or less are typically low-end)
|
|
809
|
+
val processorCount = Runtime.getRuntime().availableProcessors()
|
|
810
|
+
if (processorCount <= 2) {
|
|
811
|
+
Log.d(TAG, "Limited CPU cores: $processorCount - low-end device")
|
|
812
|
+
return false
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// Check device name for known low-end models
|
|
816
|
+
val model = android.os.Build.MODEL.lowercase()
|
|
817
|
+
val lowEndMarkers = listOf(
|
|
818
|
+
"moto g", "samsung a", "samsung j", "redmi 6", "redmi 7",
|
|
819
|
+
"honor 8a", "galaxy a01", "galaxy j2"
|
|
820
|
+
)
|
|
821
|
+
|
|
822
|
+
for (marker in lowEndMarkers) {
|
|
823
|
+
if (model.contains(marker)) {
|
|
824
|
+
Log.d(TAG, "Known low-end device model: ${android.os.Build.MODEL}")
|
|
825
|
+
return false
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
Log.d(TAG, "Device appears to be high-end (Android ${android.os.Build.VERSION.SDK_INT}, $processorCount cores, ${maxMemory}MB RAM)")
|
|
830
|
+
return true
|
|
831
|
+
} catch (e: Exception) {
|
|
832
|
+
Log.w(TAG, "Error detecting device tier: ${e.message}, defaulting to CPU-only")
|
|
833
|
+
return false
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Calculates optimal thread count based on available processors and device resources.
|
|
839
|
+
* Low-end devices use 1-2 threads to avoid memory issues.
|
|
840
|
+
*/
|
|
841
|
+
private fun getOptimalThreadCount(): Int {
|
|
842
|
+
return try {
|
|
843
|
+
val availableProcessors = Runtime.getRuntime().availableProcessors()
|
|
844
|
+
|
|
845
|
+
// For low-end devices, limit thread count
|
|
846
|
+
if (!isHighEndDevice()) {
|
|
847
|
+
Log.d(TAG, "Low-end device: limiting threads to 1-2")
|
|
848
|
+
return maxOf(1, minOf(2, availableProcessors - 1))
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// For high-end devices, use configured count or optimal calculation
|
|
852
|
+
val configured = AcceleratorConfig.cpuThreadCount
|
|
853
|
+
val optimal = maxOf(1, availableProcessors - 1)
|
|
854
|
+
|
|
855
|
+
val threadCount = if (configured > 0) {
|
|
856
|
+
minOf(configured, availableProcessors)
|
|
857
|
+
} else {
|
|
858
|
+
optimal
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
Log.d(TAG, "Optimal thread count: $threadCount (available processors: $availableProcessors)")
|
|
862
|
+
threadCount
|
|
863
|
+
} catch (e: Exception) {
|
|
864
|
+
Log.w(TAG, "Error calculating optimal threads: ${e.message}, using default")
|
|
865
|
+
AcceleratorConfig.cpuThreadCount
|
|
866
|
+
}
|
|
867
|
+
}
|
|
775
868
|
}
|
|
776
869
|
|
|
777
870
|
data class AntiSpoofingResult(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-vision-camera-spoof-detector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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/jescon-tech/react-native-vision-camera-spoof-detector",
|
|
6
6
|
"repository": {
|
|
File without changes
|