idvpackage 3.0.11__py3-none-any.whl → 3.0.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- idvpackage/common.py +4 -962
- idvpackage/iraq_id_extraction_withopenai.py +374 -893
- idvpackage/jor_passport_extraction.py +1 -6
- idvpackage/liveness_spoofing_v2.py +2 -45
- idvpackage/ocr.py +1011 -2427
- idvpackage/ocr_utils.py +144 -486
- idvpackage/pse_passport_extraction.py +18 -292
- idvpackage/qatar_id_extraction.py +4 -956
- idvpackage/sudan_passport_extraction.py +0 -928
- idvpackage/syr_passport_extraction.py +27 -402
- idvpackage/uae_id_extraction.py +87 -151
- {idvpackage-3.0.11.dist-info → idvpackage-3.0.12.dist-info}/METADATA +1 -1
- idvpackage-3.0.12.dist-info/RECORD +34 -0
- {idvpackage-3.0.11.dist-info → idvpackage-3.0.12.dist-info}/WHEEL +1 -1
- idvpackage/ekyc.py +0 -78
- idvpackage/genai_utils.py +0 -309
- idvpackage/iraq_id_extraction.py +0 -992
- idvpackage/iraq_passport_extraction.py +0 -588
- idvpackage/lazy_imports.py +0 -44
- idvpackage/lebanon_passport_extraction.py +0 -161
- idvpackage/sau_id_extraction.py +0 -248
- idvpackage/sudan_id_extraction.py +0 -764
- idvpackage-3.0.11.dist-info/RECORD +0 -42
- {idvpackage-3.0.11.dist-info → idvpackage-3.0.12.dist-info}/licenses/LICENSE +0 -0
- {idvpackage-3.0.11.dist-info → idvpackage-3.0.12.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
2
3
|
import base64
|
|
3
4
|
import time
|
|
4
5
|
from io import BytesIO
|
|
@@ -31,7 +32,6 @@ Return a JSON object with the following fields (use the exact field names):
|
|
|
31
32
|
- first_name: First name as printed on the card (extract exactly as written).
|
|
32
33
|
- gender: Gender as either M or F (printed as Sex; output MALE if M, FEMALE if F).
|
|
33
34
|
- place_of_issue: Issuing place as printed on the card (extract exactly as written).
|
|
34
|
-
- full_name: Full name as printed on the card (extract exactly as written).
|
|
35
35
|
- last_name: Last name from the full name (extract exactly as written; if not present, return null).
|
|
36
36
|
- mother_name: Mother's full name as printed on the card (look for the label "Mother Full Name" and extract the name exactly as written in English, even if Arabic is present).
|
|
37
37
|
- nationality: Nationality as printed on the card and return ISO 3166-1 alpha-3 code (e.g., JOR).
|
|
@@ -87,11 +87,6 @@ class JordanPassportFront(BaseModel):
|
|
|
87
87
|
description="Issuing place as printed on the card (extract exactly as written on the card)",
|
|
88
88
|
)
|
|
89
89
|
|
|
90
|
-
full_name: str = Field(
|
|
91
|
-
...,
|
|
92
|
-
description="Full name as printed on the card (extract exactly as written on the card)",
|
|
93
|
-
)
|
|
94
|
-
|
|
95
90
|
last_name: Optional[str] = Field(
|
|
96
91
|
None,
|
|
97
92
|
description="Last name from the full name",
|
|
@@ -8,7 +8,6 @@ import torch.nn.functional as F
|
|
|
8
8
|
from idvpackage.spoof_resources.MiniFASNet import MiniFASNetV1SE, MiniFASNetV2
|
|
9
9
|
from idvpackage.spoof_resources import transform as trans
|
|
10
10
|
import pkg_resources
|
|
11
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
12
11
|
import logging
|
|
13
12
|
MODEL_MAPPING = {"MiniFASNetV1SE": MiniFASNetV1SE, "MiniFASNetV2": MiniFASNetV2}
|
|
14
13
|
|
|
@@ -81,21 +80,6 @@ def check_image(image):
|
|
|
81
80
|
return False
|
|
82
81
|
return True
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
# def frame_count_and_save(cap):
|
|
86
|
-
# frames = []
|
|
87
|
-
# frame_skip = 8
|
|
88
|
-
# frame_index = 1
|
|
89
|
-
# status, frame = cap.read()
|
|
90
|
-
# while status:
|
|
91
|
-
# if frame_index % frame_skip == 0:
|
|
92
|
-
# frames.append(frame)
|
|
93
|
-
# frame_index += 1
|
|
94
|
-
# status, frame = cap.read()
|
|
95
|
-
# cap.release()
|
|
96
|
-
# return frames
|
|
97
|
-
|
|
98
|
-
|
|
99
83
|
def process_frame(frame, models, image_cropper):
|
|
100
84
|
frame = cv2.resize(frame, (int(frame.shape[0] * 3 / 4), frame.shape[0]))
|
|
101
85
|
if not check_image(frame):
|
|
@@ -221,46 +205,19 @@ def test(video_path):
|
|
|
221
205
|
frames_to_process = get_frames_from_video(video_path)
|
|
222
206
|
|
|
223
207
|
logging.info(f"Total frames extracted for processing: {len(frames_to_process)}")
|
|
224
|
-
|
|
225
|
-
# frames = frame_count_and_save(cap)
|
|
226
|
-
# frames_to_process = (
|
|
227
|
-
# [frames[0], frames[3], frames[6], frames[-7], frames[-4], frames[-1]]
|
|
228
|
-
# if len(frames) > 3
|
|
229
|
-
# else frames[:]
|
|
230
|
-
# )
|
|
231
|
-
|
|
232
|
-
#if no frames to process, return unknown
|
|
208
|
+
|
|
233
209
|
if not frames_to_process:
|
|
234
210
|
logging.error("No frames to process for liveness detection.")
|
|
235
211
|
return ""
|
|
236
212
|
|
|
237
213
|
else:
|
|
238
214
|
all_predictions = []
|
|
239
|
-
# with ThreadPoolExecutor() as executor:
|
|
240
|
-
# futures = [
|
|
241
|
-
# executor.submit(process_frame, frame, models, image_cropper)
|
|
242
|
-
# for frame in frames_to_process
|
|
243
|
-
# ]
|
|
244
|
-
# for future in futures:
|
|
245
|
-
# result = future.result()
|
|
246
|
-
# if result:
|
|
247
|
-
# all_predictions.append(result)
|
|
248
|
-
|
|
249
|
-
# if all_predictions.count("SPOOF") >= 3:
|
|
250
|
-
# # print('\n##################\nConsider\n##################\n')
|
|
251
|
-
# return "consider"
|
|
252
|
-
|
|
253
|
-
# # print('\n##################\nClear\n##################\n')
|
|
254
|
-
# return "clear"
|
|
255
|
-
|
|
256
215
|
for frame in frames_to_process:
|
|
257
216
|
result = process_frame(frame, models, image_cropper)
|
|
258
217
|
if result:
|
|
259
218
|
all_predictions.append(result)
|
|
260
219
|
|
|
261
220
|
if all_predictions.count("SPOOF") >= 3:
|
|
262
|
-
# print('\n##################\nConsider\n##################\n')
|
|
263
221
|
return "consider"
|
|
264
|
-
|
|
265
|
-
# print('\n##################\nClear\n##################\n')
|
|
222
|
+
|
|
266
223
|
return "clear"
|