Skip to content

Commit fc0a168

Browse files
committed
test: unknown face recognition
1 parent 10e7d85 commit fc0a168

13 files changed

Lines changed: 6509 additions & 5930 deletions

File tree

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.18] - 2023-07-05
9+
10+
### Added
11+
12+
- Changelog.md to see what changes
13+
14+
### Fixed
15+
16+
17+
18+
### Changed
19+
20+
- Data returned from FaceDetectedEndEvent and UnknownFaceDetectedEvent, from jsonString to json
21+
- Way to get listenter data changed from JSON.parse(params.jsonString) to direct get using params.faceToken,params.trackID and etc
22+
- Update readme
23+
24+
### Removed
25+
26+
27+
## [0.1.17] - 2023-07-04
28+
29+
### Added
30+
31+
- UnknownFaceDetectedEvent listener
32+
33+
### Fixed
34+
35+
36+
37+
### Changed
38+
39+
- Data returned from FaceDetectedEndEvent and UnknownFaceDetectedEvent, from only faceToken to jsonString contain of more information
40+
- New way to get listenter data, from params.faceToken become params.jsonString, JSON.parse(params.jsonString) is required to get single data in json
41+
42+
### Removed
43+

README.md

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,53 @@ DefaultPreference is the example of package in this documentation,you can freely
137137

138138
// Add an event listener to receive the data
139139
useEffect(()=>{
140-
const dataListener = eventEmitter.addListener('FaceDetectedEvent', async (params) => {
141-
//Do something here,e.g.
142-
const facetoken = params.faceToken;
143-
});
140+
const dataListener = eventEmitter.addListener('FaceDetectedEvent', async (params) => {
141+
//Do something here,e.g.
142+
const faceToken = params.faceToken;
143+
//List of data:
144+
//faceToken //use to get image/as an id to recognize a person identidy
145+
//trackID //ID number of tracking ,for reference
146+
//searchScore //percentage it match the detected face
147+
//searchThreshold //percentage required for the application to say the face match the detected face
148+
//hairType //0-5,BALD, LITTLE_HAIR, SHORT_HAIR, LONG_HAIR, UNKNOWN, INVALID
149+
//beardType //0-4, NO_BEARD, MOUSTACHE, WHISKER, UNKNOWN, INVALID
150+
//hatType //0-4, NO_HAT, SAFETY_HELMET, OTHERS, UNKNOWN, INVALID
151+
//respiratorType //0-4, COVER_MOUTH_NOSE, COVER_MOUTH, NO_RESPIRATOR, UNKNOWN, INVALID
152+
//glassesType //0-4, NO_GLASSES, GLASSES_WITH_DARK_FRAME, GLASSES_OTHERS, UNKNOWN, INVALID
153+
//skinColorType //0-4, YELLOW, WHITE, BLACK, BROWN, INVALID
154+
});
144155

145156
const stopListener = eventEmitter.addListener(
146157
'FaceDetectedEndEvent', async () => {
147158
//Do something after recognition such as remove the result view
148159
}
149160
)
161+
const unknownFaceListener= eventEmitter.addListener(
162+
'UnknownFaceDetectedEvent',
163+
async(params) =>{
164+
//Do something here,e.g.
165+
const image=params.image;
166+
//List of data:
167+
//image //image in base64 format
168+
//trackID //ID number of tracking ,for reference
169+
//searchScore //percentage it match the detected face , //may not available if no face in local group
170+
//searchThreshold //percentage required for the application to say the face match the detected face, //may not available if no face in local group
171+
//hairType //0-5,BALD, LITTLE_HAIR, SHORT_HAIR, LONG_HAIR, UNKNOWN, INVALID
172+
//beardType //0-4, NO_BEARD, MOUSTACHE, WHISKER, UNKNOWN, INVALID
173+
//hatType //0-4, NO_HAT, SAFETY_HELMET, OTHERS, UNKNOWN, INVALID
174+
//respiratorType //0-4, COVER_MOUTH_NOSE, COVER_MOUTH, NO_RESPIRATOR, UNKNOWN, INVALID
175+
//glassesType //0-4, NO_GLASSES, GLASSES_WITH_DARK_FRAME, GLASSES_OTHERS, UNKNOWN, INVALID
176+
//skinColorType //0-4, YELLOW, WHITE, BLACK, BROWN, INVALID
177+
}
178+
)
179+
180+
return () => {
181+
// Clean up and remove event listeners
182+
dataListener.remove();
183+
stopListener.remove();
184+
unknownFaceListener.remove();
185+
};
186+
150187
},[])
151188
return (
152189
<FacePassViewManager
@@ -332,51 +369,7 @@ DefaultPreference is the example of package in this documentation,you can freely
332369
setDefaultGroupName("your_group_name")
333370
```
334371
335-
- initData
336-
```sh
337-
const json = {
338-
rcAttributeAndOcclusionMode: rcAttributeAndOcclusionMode, //0-5,whole number,Default:1
339-
searchThreshold: searchThreshold, //0-100,Default:69
340-
livenessThreshold: livenessThreshold, //0-100,Default:55
341-
livenessEnabled: livenessEnabled, //true,false,Default:true
342-
rgbIrLivenessEnabled: false, //Currently only can false
343-
poseThresholdRoll: poseThresholdRoll, //0-90,Default:35
344-
poseThresholdPitch: poseThresholdPitch, //0-90,Default:35
345-
poseThresholdYaw: poseThresholdYaw, //0-90,Default:35
346-
blurThreshold: blurThreshold, //0-1,Default:0.8
347-
lowBrightnessThreshold: lowBrightnessThreshold, //0-255,Default:30
348-
highBrightnessThreshold: highBrightnessThreshold, //0-255,Default:210
349-
brightnessSTDThreshold: brightnessSTDThreshold, //0-255,Default:80
350-
faceMinThreshold: faceMinThreshold, //0-512,whole number,Default:100
351-
retryCount: retryCount, //1-unlimited,whole number,Default:2
352-
smileEnabled: smileEnabled, //true/false,Default:false
353-
maxFaceEnabled: maxFaceEnabled, //true/false,Default:true
354-
FacePoseThresholdPitch: FacePoseThresholdPitch, //0-90,Default:35
355-
FacePoseThresholdRoll: FacePoseThresholdRoll, //0-90,Default:35
356-
FacePoseThresholdYaw: FacePoseThresholdYaw, //0-90,Default:35
357-
FaceBlurThreshold: FaceBlurThreshold, //0-255,Default:0.7
358-
FaceLowBrightnessThreshold: FaceLowBrightnessThreshold, //0-255,Default:70
359-
FaceHighBrightnessThreshold: FaceHighBrightnessThreshold, //0-255,Default:220
360-
FaceBrightnessSTDThreshold: FaceBrightnessSTDThreshold, //0-255,Default:60
361-
FaceFaceMinThreshold: FaceFaceMinThreshold, //0-512,whole number,Default:100
362-
FaceRcAttributeAndOcclusionMode: FaceRcAttributeAndOcclusionMode, //whole number //0-5,Default:2
363-
}
364372
365-
try{
366-
await initData(json)
367-
}catch(e){
368-
369-
}
370-
//Recommended value
371-
try{
372-
await initData({
373-
"rcAttributeAndOcclusionMode":1,"searchThreshold":69,"livenessThreshold":55,"livenessEnabled":false,"rgbIrLivenessEnabled":false,"poseThresholdRoll":35,"poseThresholdPitch":35,"poseThresholdYaw":35,"blurThreshold":0.8,"lowBrightnessThreshold":30,"highBrightnessThreshold":210,"brightnessSTDThreshold":80,"faceMinThreshold":100,"retryCount":2,"smileEnabled":false,"maxFaceEnabled":true,"FacePoseThresholdPitch":35,"FacePoseThresholdRoll":35,"FacePoseThresholdYaw":35,"FaceBlurThreshold":0.7,"FaceLowBrightnessThreshold":70,"FaceHighBrightnessThreshold":220,"FaceBrightnessSTDThreshold":60,"FaceFaceMinThreshold":100,"FaceRcAttributeAndOcclusionMode":2
374-
})
375-
}catch(e){
376-
377-
}
378-
379-
```
380373
381374
- cameraSetting();
382375
```sh
@@ -421,7 +414,7 @@ GROUP_NAME_NOT_EXIST_ERROR // group with the provided group name is not exist
421414
GET_LOCAL_GROUP_INFO_ERROR // fail to get group info,probably the provided group not exist
422415
FACE_UNBIND_SUCCESS // Successfully unbind the face from group
423416
FACE_UNBIND_FAILED // Fail to unbind face from group
424-
EMPTY_LOCAL_GROUP_ERROR // No local group found
417+
EMPTY_LOCAL_GROUP_ERROR // No local group found in the application.
425418
EMPTY_GROUP_INPUT_ERROR // No group anme provided
426419
GROUP_CREATION_SUCCESS //Success in group creation
427420
GROUP_CREATION_FAILED //Fail to create group

android/src/main/java/com/fppreactnativemodule/FacePass.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,21 @@ public void selectImage(Callback successCallback, Callback cancelCallback) {
527527
};
528528

529529
@ReactMethod
530-
public void sendDataToReactNative(String faceToken) {
531-
WritableMap params = Arguments.createMap();
532-
params.putString("faceToken", faceToken);
530+
public void sendDataToReactNative(WritableMap params) {
531+
533532
getReactApplicationContext()
534533
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
535534
.emit("FaceDetectedEvent", params);
536535
}
537536

537+
@ReactMethod
538+
public void sendUnknownDataToReactNative(WritableMap params) {
539+
540+
getReactApplicationContext()
541+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
542+
.emit("UnknownFaceDetectedEvent", params);
543+
}
544+
538545
@ReactMethod
539546
public void sendStopToReactNative() {
540547
WritableMap params = Arguments.createMap();

0 commit comments

Comments
 (0)