├── MiRequest_FaceLiveSDK ├── 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 └── run_faceliveness_docker /MiRequest_FaceLiveSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/MiRequest_FaceLiveSDK -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Face Liveness Detection Docker

3 | MiniAiLive Logo 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) Docker. 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 Docker 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 Docker Image:** 33 | 34 | Download the Server Docker Image from the following link: 35 | 36 | [Download the On-premise Server Installer](https://drive.google.com/file/d/1c4I_GZvQzaqlIqyZMzOEiEB1_tqL_-GP/view?usp=sharing) 37 | 38 | 2. **Install the On-premise Docker Server:** 39 | 40 | Run the Docker Image 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 docker load -i MiniAiLive-FaceLiveSDK-DockerImg.tar 44 | ``` 45 |
46 | MiniAiLive Installer 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 | $ sudo chmod 777 ./MiRequest_FaceLiveSDK 56 | $ sudo ./MiRequest_FaceLiveSDK request /home/ubuntu/Download/trial_key.miq 57 | ``` 58 |
59 | MiniAiLive Installer 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 apt install chrony 66 | $ sudo chmod 777 ./run_faceliveness_docker 67 | $ sudo ./run_faceliveness_docker /home/ubuntu/Downloads/trial_key.mis 8092 mini-facelivesdk-server 68 | ``` 69 |
70 | MiniAiLive Installer 71 |
72 | 73 | 4. **Verify Installation:** 74 | 75 | After installation, verify that the On-premise Server is correctly installed by using this command: 76 | ```sh 77 | $ netstat -tnpl 78 | ``` 79 | If you can see opened your port correctly, the server has been installed successfully. Refer the below image. 80 |
81 | MiniAiLive Installer 82 |
83 | 84 | ## Face-LivenessSDK API Details 85 | 86 | ### Endpoint 87 | 88 | - `POST http://127.0.0.1:8092/api/check_liveness` Face Liveness Detection API 89 | - `POST http://127.0.0.1:8092/api/check_liveness_base64` Face Liveness Detection API 90 | 91 | ### Request 92 | 93 | - **URL:** `http://127.0.0.1:8092/api/check_liveness` 94 | - **Method:** `POST` 95 | - **Form Data:** 96 | - `image`: The image file (PNG, JPG, etc.) to be analyzed. This should be provided as a file upload. 97 |
98 | Screenshot 2024-07-16 at 5 12 01 AM 99 |
100 | 101 | 102 | - **URL:** `http://127.0.0.1:8092/api/check_liveness_base64` 103 | - **Method:** `POST` 104 | - **Raw Data:** 105 | - `JSON Format`: 106 | { 107 | "image": "--base64 image data here--" 108 | } 109 |
110 | Screenshot 2024-07-16 at 5 11 34 AM 111 |
112 | 113 | 114 | ### Response 115 | 116 | The API returns a JSON object with the liveness result of the input face image. Here is an example response: 117 |
118 | 119 |
120 | 121 | ## Gradio Demo 122 | 123 | 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. 124 | 125 | ### How to Run the Gradio Demo 126 | 127 | 1. **Install Gradio:** 128 | 129 | First, you need to install Gradio. You can do this using pip: 130 | 131 | ```sh 132 | git clone https://github.com/MiniAiLive/FaceLivenessDetection-Docker.git 133 | pip install -r requirement.txt 134 | cd gradio 135 | ``` 136 | 2. **Run Gradio Demo:** 137 | ```sh 138 | python app.py 139 | ``` 140 | ## Python Test API Example 141 | 142 | 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 143 | 144 | ### Prerequisites 145 | 146 | - Python 3.6+ 147 | - `requests` library (you can install it using `pip install requests`) 148 | 149 | ### Example Script 150 | 151 | This example demonstrates how to send an image file to the API endpoint and process the response. 152 | 153 | ```python 154 | import requests 155 | 156 | # URL of the web API endpoint 157 | url = 'http://127.0.0.1:8092/api/check_liveness' 158 | 159 | # Path to the image file you want to send 160 | image_path = './test_image.jpg' 161 | 162 | # Read the image file and send it as form data 163 | files = {'image': open(image_path, 'rb')} 164 | 165 | try: 166 | # Send POST request 167 | response = requests.post(url, files=files) 168 | 169 | # Check if the request was successful 170 | if response.status_code == 200: 171 | print('Request was successful!') 172 | # Parse the JSON response 173 | response_data = response.json() 174 | print('Response Data:', response_data) 175 | else: 176 | print('Request failed with status code:', response.status_code) 177 | print('Response content:', response.text) 178 | 179 | except requests.exceptions.RequestException as e: 180 | print('An error occurred:', e) 181 | ``` 182 | 183 | ## Request license 184 | 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). 185 | 186 | 187 | ## Face & IDSDK Online Demo, Resources 188 |
189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 |
201 |
202 | 203 | ## Our Products 204 | 205 | ### Face Recognition SDK 206 | | No | Project | Features | 207 | |----|---------|-----------| 208 | | 1 | [FaceRecognition-SDK-Docker](https://github.com/MiniAiLive/FaceRecognition-SDK-Docker) | 1:1 & 1:N Face Matching SDK | 209 | | 2 | [FaceRecognition-SDK-Windows](https://github.com/MiniAiLive/FaceRecognition-SDK-Windows) | 1:1 & 1:N Face Matching SDK | 210 | | 3 | [FaceRecognition-SDK-Linux](https://github.com/MiniAiLive/FaceRecognition-SDK-Linux) | 1:1 & 1:N Face Matching SDK | 211 | | 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 | 212 | | 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 | 213 | | 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 | 214 | | 7 | [FaceMatching-SDK-Android](https://github.com/MiniAiLive/FaceMatching-SDK-Android) | 1:1 Face Matching SDK | 215 | | 8 | [FaceAttributes-SDK-Android](https://github.com/MiniAiLive/FaceAttributes-SDK-Android) | Face Attributes, Age & Gender Estimation SDK | 216 | 217 | ### Face Liveness Detection SDK 218 | | No | Project | Features | 219 | |----|---------|-----------| 220 | | 1 | [FaceLivenessDetection-SDK-Docker](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Docker) | 2D & 3D Face Passive Liveness Detection SDK | 221 | | 2 | [FaceLivenessDetection-SDK-Windows](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Windows) | 2D & 3D Face Passive Liveness Detection SDK | 222 | | 3 | [FaceLivenessDetection-SDK-Linux](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Linux) | 2D & 3D Face Passive Liveness Detection SDK | 223 | | 4 | [FaceLivenessDetection-SDK-Android](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-Android) | 2D & 3D Face Passive Liveness Detection SDK | 224 | | 5 | [FaceLivenessDetection-SDK-iOS](https://github.com/MiniAiLive/FaceLivenessDetection-SDK-iOS) | 2D & 3D Face Passive Liveness Detection SDK | 225 | 226 | ### ID Document Recognition SDK 227 | | No | Project | Features | 228 | |----|---------|-----------| 229 | | 1 | [ID-DocumentRecognition-SDK-Docker](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Docker) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK | 230 | | 2 | [ID-DocumentRecognition-SDK-Windows](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Windows) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK | 231 | | 3 | [ID-DocumentRecognition-SDK-Linux](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Linux) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK | 232 | | 4 | [ID-DocumentRecognition-SDK-Android](https://github.com/MiniAiLive/ID-DocumentRecognition-SDK-Android) | ID Document, Passport, Driver License, Credit Card, MRZ Recognition SDK | 233 | 234 | ### ID Document Liveness Detection SDK 235 | | No | Project | Features | 236 | |----|---------|-----------| 237 | | 1 | [ID-DocumentLivenessDetection-SDK-Docker](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker) | ID Document Liveness Detection SDK | 238 | | 2 | [ID-DocumentLivenessDetection-SDK-Windows](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Windows) | ID Document Liveness Detection SDK | 239 | | 3 | [ID-DocumentLivenessDetection-SDK-Linux](https://github.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Linux) | ID Document Liveness Detection SDK | 240 | 241 | ### Web & Desktop Demo 242 | | No | Project | Features | 243 | |----|---------|-----------| 244 | | 1 | [FaceRecognition-IDRecognition-Playground-Next.JS](https://github.com/MiniAiLive/FaceRecognition-IDRecognition-Playground-Next.JS) | FaceSDK & IDSDK Playground | 245 | | 2 | [FaceCapture-LivenessDetection-Next.JS](https://github.com/MiniAiLive/FaceCapture-LivenessDetection-Next.JS) | Face Capture, Face LivenessDetection, Face Attributes | 246 | | 3 | [FaceMatching-Windows-App](https://github.com/MiniAiLive/FaceMatching-Windows-App) | 1:1 Face Matching Windows Demo Application | 247 | 248 | ## About MiniAiLive 249 | [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. 250 | 251 | ## Contact US 252 | For any inquiries or questions, please contact us on [WhatsApp](https://wa.me/+19162702374). 253 | 254 |

255 | www.miniai.live  256 | www.miniai.live  257 |

258 | -------------------------------------------------------------------------------- /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 | "" 23 | "" 24 | "" 25 | "{table_value}" 26 | "
FieldValue
".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-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/f_fake_andr_mask.jpg -------------------------------------------------------------------------------- /gradio/images/f_fake_andr_mask3d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/f_fake_andr_mask3d.jpg -------------------------------------------------------------------------------- /gradio/images/f_fake_andr_monitor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/f_fake_andr_monitor.jpg -------------------------------------------------------------------------------- /gradio/images/f_fake_andr_outline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/f_fake_andr_outline.jpg -------------------------------------------------------------------------------- /gradio/images/f_fake_andr_outline3d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/f_fake_andr_outline3d.jpg -------------------------------------------------------------------------------- /gradio/images/old-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/gradio/images/old-1.jpg -------------------------------------------------------------------------------- /gradio/images/old-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/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-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/f_fake_andr_mask.jpg -------------------------------------------------------------------------------- /python/test_image/f_fake_andr_mask3d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/f_fake_andr_mask3d.jpg -------------------------------------------------------------------------------- /python/test_image/f_fake_andr_monitor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/f_fake_andr_monitor.jpg -------------------------------------------------------------------------------- /python/test_image/f_fake_andr_outline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/f_fake_andr_outline.jpg -------------------------------------------------------------------------------- /python/test_image/f_fake_andr_outline3d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/f_fake_andr_outline3d.jpg -------------------------------------------------------------------------------- /python/test_image/old-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/old-1.jpg -------------------------------------------------------------------------------- /python/test_image/old-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/python/test_image/old-4.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | gradio 2 | requests -------------------------------------------------------------------------------- /run_faceliveness_docker: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiniAiLive/FaceLivenessDetection-SDK-Docker/90902367690c4a6e212ada88c17a3ca2778bc731/run_faceliveness_docker --------------------------------------------------------------------------------