react-native-vision-camera-spoof-detector 1.0.23 → 1.0.25
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/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
- package/android/.gradle/9.2.0/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/9.2.0/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.2.0/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/reports/problems/problems-report.html +659 -0
- package/index.js +17 -1
- package/ios/FaceAntiSpoofFrameProcessor.swift +283 -0
- package/ios/FaceAntiSpoofJSI.h +12 -0
- package/ios/FaceAntiSpoofJSI.mm +92 -0
- package/ios/FaceAntiSpoofManager.swift +63 -0
- package/ios/FaceAntiSpoofModule.m +191 -0
- package/ios/FaceAntiSpoofPluginRegister.m +42 -0
- package/ios/models/FaceAntiSpoofing.tflite +0 -0
- package/ios/models/model_spec.json +16 -0
- package/package.json +4 -2
- package/react-native-vision-camera-spoof-detector.podspec +22 -0
- package/.gitignore +0 -27
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <objc/runtime.h>
|
|
3
|
+
#import <objc/message.h>
|
|
4
|
+
|
|
5
|
+
// At load time, attempt to register the Swift FrameProcessor plugin with VisionCamera
|
|
6
|
+
__attribute__((constructor)) static void register_face_anti_spoof_plugin(void) {
|
|
7
|
+
@autoreleasepool {
|
|
8
|
+
Class registry = NSClassFromString(@"FrameProcessorPluginRegistry");
|
|
9
|
+
|
|
10
|
+
if (registry == Nil) {
|
|
11
|
+
return; // VisionCamera not available yet
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
SEL selector = NSSelectorFromString(@"addFrameProcessorPlugin:withInitializer:");
|
|
15
|
+
if (![registry respondsToSelector:selector]) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Create initializer block using objc_msgSend to avoid compile-time selector checks
|
|
20
|
+
id initializer = ^id(id proxy, id options) {
|
|
21
|
+
Class dynClass = NSClassFromString(@"FaceAntiSpoofFrameProcessor");
|
|
22
|
+
if (dynClass == Nil) {
|
|
23
|
+
return nil;
|
|
24
|
+
}
|
|
25
|
+
SEL allocSel = sel_registerName("alloc");
|
|
26
|
+
id alloced = ((id (*)(id, SEL))objc_msgSend)((id)dynClass, allocSel);
|
|
27
|
+
|
|
28
|
+
// Swift's exported Objective-C initializer name is `initWithProxy:options:`
|
|
29
|
+
SEL initSel = sel_registerName("initWithProxy:options:");
|
|
30
|
+
if (![alloced respondsToSelector:initSel]) {
|
|
31
|
+
return nil;
|
|
32
|
+
}
|
|
33
|
+
id instance = ((id (*)(id, SEL, id, id))objc_msgSend)(alloced, initSel, proxy, options);
|
|
34
|
+
return instance;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Call +addFrameProcessorPlugin:name with the block
|
|
38
|
+
// We use objc_msgSend to avoid compile-time dependency on the header signature
|
|
39
|
+
void (*msgSend)(id, SEL, id, id) = (void (*)(id, SEL, id, id))objc_msgSend;
|
|
40
|
+
msgSend((id)registry, selector, @"faceAntiSpoof", initializer);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model_file": "FaceAntiSpoofing.tflite",
|
|
3
|
+
"input": {
|
|
4
|
+
"shape": [1, 256, 256, 3],
|
|
5
|
+
"dtype": "float32",
|
|
6
|
+
"normalization": {"scale": 255.0}
|
|
7
|
+
},
|
|
8
|
+
"outputs": {
|
|
9
|
+
"Identity": {"shape": [1,8], "dtype": "float32", "description": "class predictions (clss_pred)"},
|
|
10
|
+
"Identity_1": {"shape": [1,8], "dtype": "float32", "description": "leaf node mask (leaf_node_mask)"}
|
|
11
|
+
},
|
|
12
|
+
"post_processing": {
|
|
13
|
+
"leafScore": "sum(abs(clss_pred[i]) * leaf_node_mask[i]) for i in 0..7",
|
|
14
|
+
"combinedScore": "calculated from neural and laplacian scores as in Android implementation"
|
|
15
|
+
}
|
|
16
|
+
}
|
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.25",
|
|
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": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"types": "index.d.ts",
|
|
29
29
|
"files": [
|
|
30
30
|
"android/",
|
|
31
|
+
"ios/",
|
|
31
32
|
".gitattributes",
|
|
32
33
|
".gitignore",
|
|
33
34
|
".npmignore",
|
|
@@ -36,7 +37,8 @@
|
|
|
36
37
|
"index.js",
|
|
37
38
|
"index.d.ts",
|
|
38
39
|
"README.md",
|
|
39
|
-
"LICENSE"
|
|
40
|
+
"LICENSE",
|
|
41
|
+
"react-native-vision-camera-spoof-detector.podspec"
|
|
40
42
|
],
|
|
41
43
|
"keywords": [
|
|
42
44
|
"react-native",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
s.name = 'react-native-vision-camera-spoof-detector'
|
|
3
|
+
s.version = '0.1.0'
|
|
4
|
+
s.summary = 'Face anti-spoof detector for VisionCamera (iOS)'
|
|
5
|
+
s.homepage = 'https://example.com'
|
|
6
|
+
s.license = { :type => 'MIT' }
|
|
7
|
+
s.authors = { 'You' => 'you@example.com' }
|
|
8
|
+
s.platform = :ios, '11.0'
|
|
9
|
+
s.source = { :path => '.' }
|
|
10
|
+
|
|
11
|
+
s.swift_version = '5.0'
|
|
12
|
+
|
|
13
|
+
s.source_files = 'ios/**/*.{h,m,mm,swift,mm,cpp,c,cc}'
|
|
14
|
+
s.resources = ['ios/models/*']
|
|
15
|
+
|
|
16
|
+
# Dependencies
|
|
17
|
+
s.dependency 'TensorFlowLiteSwift'
|
|
18
|
+
s.dependency 'VisionCamera'
|
|
19
|
+
|
|
20
|
+
# Keep default deployment target and static linkage consistent with RN
|
|
21
|
+
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
22
|
+
end
|
package/.gitignore
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Compiled class file
|
|
2
|
-
*.class
|
|
3
|
-
|
|
4
|
-
# Log file
|
|
5
|
-
*.log
|
|
6
|
-
|
|
7
|
-
# BlueJ files
|
|
8
|
-
*.ctxt
|
|
9
|
-
|
|
10
|
-
# Mobile Tools for Java (J2ME)
|
|
11
|
-
.mtj.tmp/
|
|
12
|
-
|
|
13
|
-
# Package Files #
|
|
14
|
-
*.jar
|
|
15
|
-
*.war
|
|
16
|
-
*.nar
|
|
17
|
-
*.ear
|
|
18
|
-
*.zip
|
|
19
|
-
*.tar.gz
|
|
20
|
-
*.rar
|
|
21
|
-
|
|
22
|
-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
23
|
-
hs_err_pid*
|
|
24
|
-
replay_pid*
|
|
25
|
-
|
|
26
|
-
# Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-data-in-gradle-projects
|
|
27
|
-
.kotlin/
|