├── requirements.txt
├── MiRequest_IDLiveSDK
├── run_idliveness_docker
├── gradio
├── images
│ └── demo1.jpg
└── app.py
├── python
├── test_image
│ └── id_image.jpg
└── check_id_liveness.py
└── README.md
/requirements.txt:
--------------------------------------------------------------------------------
1 | gradio
2 | requests
--------------------------------------------------------------------------------
/MiRequest_IDLiveSDK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker/HEAD/MiRequest_IDLiveSDK
--------------------------------------------------------------------------------
/run_idliveness_docker:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker/HEAD/run_idliveness_docker
--------------------------------------------------------------------------------
/gradio/images/demo1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker/HEAD/gradio/images/demo1.jpg
--------------------------------------------------------------------------------
/python/test_image/id_image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MiniAiLive/ID-DocumentLivenessDetection-SDK-Docker/HEAD/python/test_image/id_image.jpg
--------------------------------------------------------------------------------
/python/check_id_liveness.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | # URL of the API endpoint
4 | url = 'http://127.0.0.1:8093/api/check_id_liveness'
5 |
6 | # Path to the image file you want to send
7 | image_path = './test_image/id_image.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 |
--------------------------------------------------------------------------------
/gradio/app.py:
--------------------------------------------------------------------------------
1 | import gradio as gr
2 | import os
3 | import requests
4 | import json
5 |
6 | def check_id_liveness(frame):
7 | url = "http://127.0.0.1:8093/api/check_id_liveness"
8 | files = {'image': open(frame, 'rb')}
9 | try:
10 | r = requests.post(url=url, files=files)
11 | r.raise_for_status()
12 | return json.dumps(r.json(), indent=2)
13 | except requests.exceptions.RequestException as e:
14 | return str(e)
15 |
16 | # APP Interface
17 | with gr.Blocks() as MiniAIdemo:
18 | gr.Markdown(
19 | """
20 |
21 |
22 |
23 |
ID Document Liveness Detection Web Online Demo
24 |
25 |
26 |
27 |
28 |
34 |
35 | """
36 | )
37 | with gr.Tabs():
38 | with gr.TabItem("ID Document Liveness Detection"):
39 | with gr.Row():
40 | with gr.Column():
41 | im_idlive_input = gr.Image(type='filepath', height=300)
42 | gr.Examples(
43 | [
44 | os.path.join(os.path.dirname(__file__), "images/demo1.jpg"),
45 | ],
46 | inputs=im_idlive_input
47 | )
48 | btn_f_idlive = gr.Button("Analysis Document", variant='primary')
49 | with gr.Column():
50 | txt_idlive_output = gr.Textbox(label="API Response (JSON)")
51 | btn_f_idlive.click(check_id_liveness, inputs=im_idlive_input, outputs=txt_idlive_output)
52 |
53 | if __name__ == "__main__":
54 | MiniAIdemo.launch(server_port=8083, server_name="0.0.0.0")
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
ID Document Liveness Detection Docker
3 |

5 |
6 |
7 | ## Welcome to the [MiniAiLive](https://www.miniai.live/)!
8 | Welcome to the ID Document Liveness Detection Docker! MiniAiLive's Complete Document Liveness Detection Solution for Digital Onboarding here!
9 | With 70% of fraud in digital onboarding and KYC happening with document fraud—or document presentation attacks—identity verification is a critical line of defense against the financial and reputational damage of document fraud. That’s where document liveness detection software comes in. It detects when an identity document is not genuine but instead a document presentation attack.
10 | With our product suite, you can address the three most common presentation attacks universally across all the common types of identity documents anywhere in the world without needing to train on document templates.
11 | Try it out today!
12 |
13 | > **Note**
14 | >
15 | > - Our SDK is fully on-premise, processing all happens on hosting server and no data leaves server.
16 |
17 | ## Table of Contents
18 |
19 | - [Installation Guide](#installation-guide)
20 | - [API Details](#api-details)
21 | - [Gradio Demo](#gradio-demo)
22 | - [Python Test API Example](#python-test-api-example)
23 |
24 | ## ID-LivenessSDK Docker Installation Guide
25 |
26 | ### Prerequisites
27 |
28 | - Python 3.6+
29 | - Linux
30 | - CPU: 2 cores or more
31 | - RAM: 8 GB or more
32 |
33 | ### Installation Steps
34 |
35 | 1. **Download the ID Document LivenessDetection Docker Image:**
36 |
37 | Download the Server Docker Image from the following link:
38 |
39 | [Download the On-premise Server Installer](https://drive.google.com/file/d/1LOOg0otEIMZc7-08ePUxWmYfMwt-YamO/view?usp=sharing)
40 |
41 | 3. **Install the On-premise Server:**
42 |
43 | Run the installer and follow the on-screen instructions to complete the installation. Go to the Download folder and run this command.
44 | ```sh
45 | $ cd Download
46 | $ sudo docker load -i MiniAiLive-IDLiveSDK-DockerImg.tar
47 | ```
48 |
49 |

50 |
51 |
52 | You can refer our Documentation here. https://docs.miniai.live
53 |
54 | 4. **Request License and Update:**
55 |
56 | You can generate the License Request file by using this command:
57 | ```sh
58 | $ sudo chmod 777 ./MiRequest_IDLiveSDK
59 | $ sudo ./MiRequest_IDLiveSDK request /home/ubuntu/Download/trial_key.miq
60 | ```
61 |
62 |

63 |
64 |
65 | 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.
66 |
67 | ```sh
68 | $ sudo apt install chrony
69 | $ sudo chmod 777 ./run_idliveness_docker
70 | $ sudo ./run_idliveness_docker /home/ubuntu/Downloads/trial_key.mis 8093 mini-idlivesdk-server
71 | ```
72 |
73 |

74 |
75 |
76 | 5. **Verify Installation:**
77 |
78 | After installation, verify that the On-premise Server is correctly installed by using this command:
79 | ```sh
80 | $ netstat -tnpl
81 | ```
82 | If you can see opened your port correctly, the server has been installed successfully. Refer the below image.
83 |
84 |

85 |
86 |
87 | ## ID-LivenessSDK API Details
88 |
89 | ### Endpoint
90 |
91 | - `POST http://127.0.0.1:8093/api/check_id_liveness` ID Document Liveness Detection API
92 | - `POST http://127.0.0.1:8093/api/check_id_liveness_base64` ID Document Liveness Detection API
93 |
94 | ### Request
95 |
96 | - **URL:** `http://127.0.0.1:8093/api/check_id_liveness`
97 | - **Method:** `POST`
98 | - **Form Data:**
99 | - `image`: The image file (PNG, JPG, etc.) to be analyzed. This should be provided as a file upload.
100 |
101 |
102 | - **URL:** `http://127.0.0.1:8093/api/check_id_liveness_base64`
103 | - **Method:** `POST`
104 | - **Raw Data:**
105 | - `JSON Format`:
106 | {
107 | "image": "--base64 image data here--"
108 | }
109 |
110 |
111 | ### Response
112 |
113 | The API returns a JSON object with the ID document liveness detection details. Here is an example response:
114 |
115 |

116 |
117 |
118 | ## Gradio Demo
119 |
120 | We have included a Gradio demo to showcase the capabilities of our ID Document Liveness Detection SDK. Gradio is a Python library that allows you to quickly create user interfaces for machine learning models.
121 |
122 | ### How to Run the Gradio Demo
123 |
124 | 1. **Install Gradio:**
125 |
126 | First, you need to install Gradio. You can do this using pip:
127 |
128 | ```sh
129 | git clone https://github.com/MiniAiLive/ID-DocumentLivenessDetection-Docker.git
130 | pip install -r requirement.txt
131 | cd gradio
132 | ```
133 | 2. **Run Gradio Demo:**
134 | ```sh
135 | python app.py
136 | ```
137 | ## Python Test API Example
138 |
139 | To help you get started with using the API, here is a comprehensive example of how to interact with the ID Document Liveness Detection API using Python. You can use API with another language you want to use like C++, C#, Ruby, Java, Javascript, and more
140 |
141 | ### Prerequisites
142 |
143 | - Python 3.6+
144 | - `requests` library (you can install it using `pip install requests`)
145 |
146 | ### Example Script
147 |
148 | This example demonstrates how to send an image file to the API endpoint and process the response.
149 |
150 | ```python
151 | import requests
152 |
153 | # URL of the web API endpoint
154 | url = 'http://127.0.0.1:8093/api/check_id_liveness'
155 |
156 | # Path to the image file you want to send
157 | image_path = './test_image.jpg'
158 |
159 | # Read the image file and send it as form data
160 | files = {'image': open(image_path, 'rb')}
161 |
162 | try:
163 | # Send POST request
164 | response = requests.post(url, files=files)
165 |
166 | # Check if the request was successful
167 | if response.status_code == 200:
168 | print('Request was successful!')
169 | # Parse the JSON response
170 | response_data = response.json()
171 | print('Response Data:', response_data)
172 | else:
173 | print('Request failed with status code:', response.status_code)
174 | print('Response content:', response.text)
175 |
176 | except requests.exceptions.RequestException as e:
177 | print('An error occurred:', e)
178 | ```
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 |
--------------------------------------------------------------------------------