├── README.md
├── gradio
├── app.py
└── images
│ ├── f_fake_andr_mask.jpg
│ ├── f_fake_andr_mask3d.jpg
│ ├── f_fake_andr_monitor.jpg
│ ├── f_fake_andr_outline.jpg
│ ├── f_fake_andr_outline3d.jpg
│ ├── old-1.jpg
│ └── old-4.jpg
├── python
├── check_liveness.py
└── test_image
│ ├── f_fake_andr_mask.jpg
│ ├── f_fake_andr_mask3d.jpg
│ ├── f_fake_andr_monitor.jpg
│ ├── f_fake_andr_outline.jpg
│ ├── f_fake_andr_outline3d.jpg
│ ├── old-1.jpg
│ └── old-4.jpg
└── requirements.txt
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
Face Liveness Detection Linux SDK
3 |

5 |
6 |
7 | ## Welcome to the [MiniAiLive](https://www.miniai.live/)!
8 | A 100% spoofing-prevention rate for both 3D printed and resin facial masks, confirms MiniAiLive® as a leading facial recognition solution for preventing biometric fraud in remote applications, such as online banking, requiring identity verification before granting access to sensitive data or valuable assets. Feel free to use our MiniAI 3D Face Passive Liveness Detection (face anti-spoofing) Linux SDK.
9 |
10 | > **Note**
11 | >
12 | > SDK is fully on-premise, processing all happens on hosting server and no data leaves server.
13 |
14 | ## Table of Contents
15 |
16 | - [Installation Guide](#installation-guide)
17 | - [API Details](#api-details)
18 | - [Gradio Demo](#gradio-demo)
19 | - [Python Test API Example](#python-test-api-example)
20 |
21 | ## Face-LivenessSDK Installation Guide
22 |
23 | ### Prerequisites
24 |
25 | - Python 3.6+
26 | - Linux
27 | - CPU: 2 cores or more
28 | - RAM: 8 GB or more
29 |
30 | ### Installation Steps
31 |
32 | 1. **Download the Face Liveness Detection Linux Server Installer:**
33 |
34 | Download the Server installer for your operating system from the following link:
35 |
36 | [Download the On-premise Server Installer](https://drive.google.com/file/d/1nFxftQYJPh-BJ5NRiIaAG5d9bC5Ydo5E/view?usp=sharing)
37 |
38 | 2. **Install the On-premise Server:**
39 |
40 | Run the installer and follow the on-screen instructions to complete the installation. Go to the Download folder and run this command.
41 | ```sh
42 | $ cd Download
43 | $ sudo dpkg -i --force-overwrite MiniAiLive-FaceLiveness-LinuxServer.deb
44 | ```
45 |
46 |

47 |
48 |
49 | You can refer our Documentation here. https://docs.miniai.live
50 |
51 | 3. **Request License and Update:**
52 |
53 | You can generate the License Request file by using this command:
54 | ```sh
55 | $ cd /opt/mini-faceliveness/
56 | $ sudo ./MiRequest request /home/ubuntu/Download/trial_request.miq
57 | ```
58 |
59 |

60 |
61 |
62 | Then you can see the license request file on your directory, and send it to us via email or WhatsApp. We will send the license based on your Unique Request file, then you can upload the license file to allow to use. Refer the below images.
63 |
64 | ```sh
65 | $ sudo ./MiRequest update /home/ubuntu/Download/Faceliveness_trial_linux.mis
66 | ```
67 |
68 |

69 |
70 |
71 | 4. **Verify Installation:**
72 |
73 | After installation, verify that the On-premise Server is correctly installed by using this command:
74 | ```sh
75 | $ systemctl list-units --state running
76 | ```
77 | If you can see 'Mini-faceliveness-svc.service', the server has been installed successfully. Refer the below image.
78 |
79 |

80 |
81 |
82 | ## Face-LivenessSDK API Details
83 |
84 | ### Endpoint
85 |
86 | - `POST http://127.0.0.1:8092/api/check_liveness` Face Liveness Detection API
87 | - `POST http://127.0.0.1:8092/api/check_liveness_base64` Face Liveness Detection API
88 |
89 | ### Request
90 |
91 | - **URL:** `http://127.0.0.1:8092/api/check_liveness`
92 | - **Method:** `POST`
93 | - **Form Data:**
94 | - `image`: The image file (PNG, JPG, etc.) to be analyzed. This should be provided as a file upload.
95 |
96 |

97 |
98 |
99 |
100 | - **URL:** `http://127.0.0.1:8092/api/check_liveness_base64`
101 | - **Method:** `POST`
102 | - **Raw Data:**
103 | - `JSON Format`:
104 | {
105 | "image": "--base64 image data here--"
106 | }
107 |
108 |

109 |
110 |
111 |
112 | ### Response
113 |
114 | The API returns a JSON object with the liveness result of the input face image. Here is an example response:
115 |
116 |

117 |
118 |
119 | ## Gradio Demo
120 |
121 | We have included a Gradio demo to showcase the capabilities of our Face Liveness Detection SDK. Gradio is a Python library that allows you to quickly create user interfaces for machine learning models.
122 |
123 | ### How to Run the Gradio Demo
124 |
125 | 1. **Install Gradio:**
126 |
127 | First, you need to install Gradio. You can do this using pip:
128 |
129 | ```sh
130 | git clone https://github.com/MiniAiLive/FaceLivenessDetection-Linux.git
131 | pip install -r requirement.txt
132 | cd gradio
133 | ```
134 | 2. **Run Gradio Demo:**
135 | ```sh
136 | python app.py
137 | ```
138 | ## Python Test API Example
139 |
140 | To help you get started with using the API, here is a comprehensive example of how to interact with the Face Liveness Detection API using Python. You can use API with another language you want to use like C++, C#, Ruby, Java, Javascript, and more
141 |
142 | ### Prerequisites
143 |
144 | - Python 3.6+
145 | - `requests` library (you can install it using `pip install requests`)
146 |
147 | ### Example Script
148 |
149 | This example demonstrates how to send an image file to the API endpoint and process the response.
150 |
151 | ```python
152 | import requests
153 |
154 | # URL of the web API endpoint
155 | url = 'http://127.0.0.1:8092/api/check_liveness'
156 |
157 | # Path to the image file you want to send
158 | image_path = './test_image.jpg'
159 |
160 | # Read the image file and send it as form data
161 | files = {'image': open(image_path, 'rb')}
162 |
163 | try:
164 | # Send POST request
165 | response = requests.post(url, files=files)
166 |
167 | # Check if the request was successful
168 | if response.status_code == 200:
169 | print('Request was successful!')
170 | # Parse the JSON response
171 | response_data = response.json()
172 | print('Response Data:', response_data)
173 | else:
174 | print('Request failed with status code:', response.status_code)
175 | print('Response content:', response.text)
176 |
177 | except requests.exceptions.RequestException as e:
178 | print('An error occurred:', e)
179 | ```
180 |
181 | ## Request license
182 | Feel free to [Contact US](https://www.miniai.live/contact/) to get a trial License. We are 24/7 online on [WhatsApp](https://wa.me/+19162702374).
183 |
184 |
185 | ## Face & IDSDK Online Demo, Resources
186 |
200 |
201 | ## Our Products
202 |
203 | ### Face Recognition SDK
204 | | No | Project | Features |
205 | |----|---------|-----------|
206 | | 1 | [FaceRecognition-SDK-Docker](https://github.com/MiniAiLive/FaceRecognition-SDK-Docker) | 1:1 & 1:N Face Matching SDK |
207 | | 2 | [FaceRecognition-SDK-Windows](https://github.com/MiniAiLive/FaceRecognition-SDK-Windows) | 1:1 & 1:N Face Matching SDK |
208 | | 3 | [FaceRecognition-SDK-Linux](https://github.com/MiniAiLive/FaceRecognition-SDK-Linux) | 1:1 & 1:N Face Matching SDK |
209 | | 4 | [FaceRecognition-LivenessDetection-SDK-Android](https://github.com/MiniAiLive/FaceRecognition-LivenessDetection-SDK-Android) | 1:1 & 1:N Face Matching, 2D & 3D Face Passive Liveness Detection SDK |
210 | | 5 | [FaceRecognition-LivenessDetection-SDK-iOS](https://github.com/MiniAiLive/FaceRecognition-LivenessDetection-SDK-iOS) | 1:1 & 1:N Face Matching, 2D & 3D Face Passive Liveness Detection SDK |
211 | | 6 | [FaceRecognition-LivenessDetection-SDK-CPP](https://github.com/MiniAiLive/FaceRecognition-LivenessDetection-SDK-CPP) | 1:1 & 1:N Face Matching, 2D & 3D Face Passive Liveness Detection SDK |
212 | | 7 | [FaceMatching-SDK-Android](https://github.com/MiniAiLive/FaceMatching-SDK-Android) | 1:1 Face Matching SDK |
213 | | 8 | [FaceAttributes-SDK-Android](https://github.com/MiniAiLive/FaceAttributes-SDK-Android) | Face Attributes, Age & Gender Estimation SDK |
214 |
215 | ### Face Liveness Detection SDK
216 | | No | Project | Features |
217 | |----|---------|-----------|
218 | | 1 | [FaceLivenessDetection-SDK-Docker](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Docker) | 2D & 3D Face Passive Liveness Detection SDK |
219 | | 2 | [FaceLivenessDetection-SDK-Windows](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Windows) | 2D & 3D Face Passive Liveness Detection SDK |
220 | | 3 | [FaceLivenessDetection-SDK-Linux](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Linux) | 2D & 3D Face Passive Liveness Detection SDK |
221 | | 4 | [FaceLivenessDetection-SDK-Android](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Android) | 2D & 3D Face Passive Liveness Detection SDK |
222 | | 5 | [FaceLivenessDetection-SDK-iOS](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-iOS) | 2D & 3D Face Passive Liveness Detection SDK |
223 |
224 | ### ID Document Recognition SDK
225 | | No | Project | Features |
226 | |----|---------|-----------|
227 | | 1 | [ID-DocumentRecognition-SDK-Docker](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Docker) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK |
228 | | 2 | [ID-DocumentRecognition-SDK-Windows](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Windows) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK |
229 | | 3 | [ID-DocumentRecognition-SDK-Linux](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Linux) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK |
230 | | 4 | [ID-DocumentRecognition-SDK-Android](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Android) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK |
231 |
232 | ### ID Document Liveness Detection SDK
233 | | No | Project | Features |
234 | |----|---------|-----------|
235 | | 1 | [ID-DocumentLivenessDetection-SDK-Docker](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker) | ID Document Liveness Detection SDK |
236 | | 2 | [ID-DocumentLivenessDetection-SDK-Windows](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Windows) | ID Document Liveness Detection SDK |
237 | | 3 | [ID-DocumentLivenessDetection-SDK-Linux](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Linux) | ID Document Liveness Detection SDK |
238 |
239 | ### Web & Desktop Demo
240 | | No | Project | Features |
241 | |----|---------|-----------|
242 | | 1 | [FaceRecognition-IDRecognition-Playground-Next.JS](https://github.com/MiniAiLive/FaceRecognition-IDRecognition-Playground-Next.JS) | FaceSDK & IDSDK Playground |
243 | | 2 | [FaceCapture-LivenessDetection-Next.JS](https://github.com/MiniAiLive/FaceCapture-LivenessDetection-Next.JS) | Face Capture, Face LivenessDetection, Face Attributes |
244 | | 3 | [FaceMatching-Windows-App](https://github.com/MiniAiLive/FaceMatching-Windows-App) | 1:1 Face Matching Windows Demo Application |
245 |
246 | ## About MiniAiLive
247 | [MiniAiLive](https://www.miniai.live/) is a leading AI solutions company specializing in computer vision and machine learning technologies. We provide cutting-edge solutions for various industries, leveraging the power of AI to drive innovation and efficiency.
248 |
249 | ## Contact US
250 | For any inquiries or questions, please contact us on [WhatsApp](https://wa.me/+19162702374).
251 |
252 |
253 |
254 |
255 |
256 |
--------------------------------------------------------------------------------
/gradio/app.py:
--------------------------------------------------------------------------------
1 | import gradio as gr
2 | import os
3 | import requests
4 |
5 | def check_liveness(frame):
6 | url = "http://127.0.0.1:8092/api/check_liveness"
7 | files = {'image': open(frame, 'rb')}
8 | r = requests.post(url=url, files=files)
9 |
10 | html = None
11 | table_value = ""
12 |
13 | for key, value in r.json().items():
14 | row_value = (""
15 | "{key} | "
16 | "{value} | "
17 | "
".format(key=key, value=value))
18 | table_value = table_value + row_value
19 |
20 | html = (""
21 | ""
22 | "Field | "
23 | "Value | "
24 | "
"
25 | "{table_value}"
26 | "
".format(table_value=table_value))
27 |
28 | return html
29 |
30 | # APP Interface
31 | with gr.Blocks() as MiniAIdemo:
32 | gr.Markdown(
33 | """
34 |
35 |
36 |
37 |
Face Liveness Detection Web Online Demo
38 |
39 |
40 |
41 |
42 |
48 |
49 | """
50 | )
51 | with gr.Tabs():
52 | with gr.TabItem("Face Liveness Detection"):
53 | with gr.Row():
54 | with gr.Column():
55 | im_live_input = gr.Image(type='filepath', height=300)
56 | gr.Examples(
57 | [
58 | os.path.join(os.path.dirname(__file__), "images/f_fake_andr_mask.jpg"),
59 | os.path.join(os.path.dirname(__file__), "images/f_fake_andr_mask3d.jpg"),
60 | os.path.join(os.path.dirname(__file__), "images/f_fake_andr_monitor.jpg"),
61 | os.path.join(os.path.dirname(__file__), "images/f_fake_andr_outline.jpg"),
62 | os.path.join(os.path.dirname(__file__), "images/f_fake_andr_outline3d.jpg"),
63 | os.path.join(os.path.dirname(__file__), "images/old-1.jpg"),
64 | os.path.join(os.path.dirname(__file__), "images/old-4.jpg"),
65 | ],
66 | inputs=im_live_input
67 | )
68 | btn_f_live = gr.Button("Check Liveness", variant='primary')
69 | with gr.Column():
70 | txt_live_output = gr.HTML()
71 | btn_f_live.click(check_liveness, inputs=im_live_input, outputs=txt_live_output)
72 |
73 | if __name__ == "__main__":
74 | MiniAIdemo.launch(server_port=8083, server_name="0.0.0.0")
--------------------------------------------------------------------------------
/gradio/images/f_fake_andr_mask.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/f_fake_andr_mask.jpg
--------------------------------------------------------------------------------
/gradio/images/f_fake_andr_mask3d.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/f_fake_andr_mask3d.jpg
--------------------------------------------------------------------------------
/gradio/images/f_fake_andr_monitor.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/f_fake_andr_monitor.jpg
--------------------------------------------------------------------------------
/gradio/images/f_fake_andr_outline.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/f_fake_andr_outline.jpg
--------------------------------------------------------------------------------
/gradio/images/f_fake_andr_outline3d.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/f_fake_andr_outline3d.jpg
--------------------------------------------------------------------------------
/gradio/images/old-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/old-1.jpg
--------------------------------------------------------------------------------
/gradio/images/old-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/gradio/images/old-4.jpg
--------------------------------------------------------------------------------
/python/check_liveness.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | # URL of the API endpoint
4 | url = 'http://127.0.0.1:8092/api/check_liveness'
5 |
6 | # Path to the image file you want to send
7 | image_path = './test_image/f_fake_andr_mask.jpg'
8 |
9 | # Read the image file and encode it as a base64 string
10 | files = {'image': open(image_path, 'rb')}
11 |
12 | try:
13 | # Send POST request
14 | response = requests.post(url, files=files)
15 |
16 | # Check if the request was successful
17 | if response.status_code == 200:
18 | print('Request was successful!')
19 | # Parse the JSON response
20 | response_data = response.content
21 | print('Response Data :', response_data)
22 | else:
23 | print('Request failed with status code:', response.status_code)
24 | print('Response content:', response.text)
25 |
26 | except requests.exceptions.RequestException as e:
27 | print('An error occurred:', e)
28 |
--------------------------------------------------------------------------------
/python/test_image/f_fake_andr_mask.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/f_fake_andr_mask.jpg
--------------------------------------------------------------------------------
/python/test_image/f_fake_andr_mask3d.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/f_fake_andr_mask3d.jpg
--------------------------------------------------------------------------------
/python/test_image/f_fake_andr_monitor.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/f_fake_andr_monitor.jpg
--------------------------------------------------------------------------------
/python/test_image/f_fake_andr_outline.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/f_fake_andr_outline.jpg
--------------------------------------------------------------------------------
/python/test_image/f_fake_andr_outline3d.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/f_fake_andr_outline3d.jpg
--------------------------------------------------------------------------------
/python/test_image/old-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/old-1.jpg
--------------------------------------------------------------------------------
/python/test_image/old-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Linux/f3a1f0b5e0ecddddf11c9d04f911f31f9f44ab95/python/test_image/old-4.jpg
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | gradio
2 | requests
--------------------------------------------------------------------------------