Skip to content

Commit 1e89ec0

Browse files
committed
2 parents 93270dd + 5cb52ab commit 1e89ec0

File tree

1 file changed

+88
-5
lines changed

1 file changed

+88
-5
lines changed

README.md

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ It includes features that allow for testing face liveness detection using both i
2323
| Eye Closure Detection | Eye Closure Detection |
2424
| Mouth Opening Check | Mouth Opening Check |
2525

26-
26+
> Reference
2727
> - [Face Liveness Detection - Android(Basic SDK)](https://github.com/kby-ai/FaceLivenessDetection-Android)
2828
> - [Face Liveness Detection - iOS(Basic SDK)](https://github.com/kby-ai/FaceLivenessDetection-iOS)
2929
> - [Face Recognition - Android(Stdndard SDK)](https://github.com/kby-ai/FaceRecognition-Android)
@@ -70,7 +70,7 @@ This project uses KBY-AI's Face Liveness Detection Server SDK, which requires a
7070
- OS: Ubuntu 20.04 or later
7171
- Dependency: OpenVINO™ Runtime (Version: 2022.3)
7272
73-
### 2. Setup and test
73+
### 2. Setup and Test
7474
- Clone the project:
7575
```
7676
git clone https://github.com/kby-ai/FaceLivenessDetection-Docker.git
@@ -104,11 +104,94 @@ This project uses KBY-AI's Face Liveness Detection Server SDK, which requires a
104104
105105
Test with a base64-encoded image: Send a POST request to http://{xx.xx.xx.xx}:8080/check_liveness_base64.
106106
107-
You can download the Postman collection to easily access and use these endpoints. [click here](https://github.com/kby-ai/FaceLivenessDetection-Docker/blob/main/postman/kby-ai-live.postman_collection.json)
107+
You can download the Postman collection to easily access and use these endpoints. [click here](https://github.com/kby-ai/FaceLivenessDetection-Docker/blob/main/postman/kby-ai-live.postman_collection.json)
108108
109+
## About SDK
109110
110-
111-
111+
### 1. Initializing an SDK
112112
113+
- Step One
113114
115+
First, obtain the machine code for activation and request a license based on the machine code.
116+
```
117+
machineCode = getMachineCode()
118+
print("machineCode: ", machineCode.decode('utf-8'))
119+
```
120+
121+
- Step Two
122+
123+
Next, activate the SDK using the received license.
124+
```
125+
setActivation(license.encode('utf-8'))
126+
```
127+
If activation is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.
128+
129+
- Step Three
130+
131+
After activation, call the initialization function of the SDK.
132+
```
133+
initSDK("data".encode('utf-8'))
134+
```
135+
The first parameter is the path to the model.
114136
137+
If initialization is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.
138+
139+
### 2. Enum and Structure
140+
- SDK_ERROR
141+
142+
This enumeration represents the return value of the 'initSDK' and 'setActivation' functions.
143+
144+
| Feature| Value | Name |
145+
|------------------|------------------|------------------|
146+
| Successful activation or initialization | 0 | SDK_SUCCESS |
147+
| License key error | -1 | SDK_LICENSE_KEY_ERROR |
148+
| AppID error (Not used in Server SDK) | -2 | SDK_LICENSE_APPID_ERROR |
149+
| License expiration | -3 | SDK_LICENSE_EXPIRED |
150+
| Not activated | -4 | SDK_NO_ACTIVATED |
151+
| Failed to initialize SDK | -5 | SDK_INIT_ERROR |
152+
153+
- FaceBox
154+
155+
This structure represents the output of the face detection function.
156+
157+
| Feature| Type | Name |
158+
|------------------|------------------|------------------|
159+
| Face rectangle | int | x1, y1, x2, y2 |
160+
| Liveness score (0 ~ 1) | float | liveness |
161+
| Face angles (-45 ~ 45) | float | yaw, roll, pitch |
162+
| Face quality (0 ~ 1) | float | face_quality |
163+
| Face luminance (0 ~ 255) | float | face_luminance |
164+
| Eye distance (pixels) | float | eye_dist |
165+
| Eye closure (0 ~ 1) | float | left_eye_closed, right_eye_closed |
166+
| Face occlusion (0 ~ 1) | float | face_occlusion |
167+
| Mouth opening (0 ~ 1) | float | mouth_opened |
168+
| 68 points facial landmark | float[] | landmarks_68 |
169+
170+
> 68 points facial landmark
171+
172+
<img src="https://user-images.githubusercontent.com/125717930/235560305-ee1b6a39-5dab-4832-a214-732c379cabfd.png" width=500/>
173+
174+
### 3. APIs
175+
- Face Detection
176+
177+
The Face SDK provides a single API for detecting faces, performing liveness detection, determining face orientation (yaw, roll, pitch), assessing face quality, detecting facial occlusion, eye closure, mouth opening, and identifying facial landmarks.
178+
179+
The function can be used as follows:
180+
181+
```
182+
faceBoxes = (FaceBox * maxFaceCount)()
183+
faceCount = faceDetection(image_np, image_np.shape[1], image_np.shape[0], faceBoxes, maxFaceCount)
184+
```
185+
186+
This function requires 5 parameters.
187+
* The first parameter: the byte array of the RGB image buffer.
188+
* The second parameter: the width of the image.
189+
* The third parameter: the height of the image.
190+
* The fourth parameter: the 'FaceBox' array allocated with 'maxFaceCount' for storing the detected faces.
191+
* The fifth parameter: the count allocated for the maximum 'FaceBox' objects.
192+
193+
The function returns the count of the detected face.
194+
195+
### 4. Thresholds
196+
The default thresholds are as the following below:
197+
https://github.com/kby-ai/FaceLivenessDetection-Docker/blob/6aafd08dba5093600008ec66df39f362e53f9bb8/app.py#L17-L29

0 commit comments

Comments
 (0)