ImagePRO-Python 0.4.0__tar.gz → 0.5.0__tar.gz
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.
- {imagepro_python-0.4.0/src/ImagePRO_Python.egg-info → imagepro_python-0.5.0}/PKG-INFO +2 -1
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/pyproject.toml +4 -2
- imagepro_python-0.5.0/src/ImagePRO/human_analysis/face_analysis/face_comparison.py +60 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/dataset_generator.py +1 -1
- {imagepro_python-0.4.0 → imagepro_python-0.5.0/src/ImagePRO_Python.egg-info}/PKG-INFO +2 -1
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO_Python.egg-info/SOURCES.txt +1 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO_Python.egg-info/requires.txt +1 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/LICENSE +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/setup.cfg +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/body_analysis/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/body_analysis/hand_tracking.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/face_analysis/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/face_analysis/face_detection.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/object_analysis/object_detection.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/blur.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/contrast.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/crop.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/grayscale.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/resize.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/rotate.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/sharpen.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/utils/__init__.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/utils/io_handler.py +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO_Python.egg-info/dependency_links.txt +0 -0
- {imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO_Python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ImagePRO-Python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: clean, modular, and easy-to-use Python library for image processing tasks.
|
|
5
5
|
Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -16,4 +16,5 @@ Requires-Dist: numpy<3.0,>=1.24
|
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
17
|
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
18
|
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
19
|
+
Requires-Dist: insightface<1.0,>=0.7
|
|
19
20
|
Dynamic: license-file
|
|
@@ -7,7 +7,7 @@ where = ["src"]
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "ImagePRO-Python"
|
|
10
|
-
version = "0.
|
|
10
|
+
version = "0.5.0"
|
|
11
11
|
description = "clean, modular, and easy-to-use Python library for image processing tasks."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = "==3.10.*"
|
|
@@ -25,8 +25,10 @@ dependencies = [
|
|
|
25
25
|
"numpy>=1.24,<3.0",
|
|
26
26
|
"opencv-python>=4.8,<5.0",
|
|
27
27
|
"ultralytics>=8.2.0,<9.0",
|
|
28
|
-
"mediapipe>=0.10.0,<1.0",
|
|
28
|
+
"mediapipe>=0.10.0,<1.0",
|
|
29
|
+
"insightface>=0.7,<1.0",
|
|
29
30
|
]
|
|
30
31
|
|
|
32
|
+
|
|
31
33
|
[tool.hatch.build.targets.wheel]
|
|
32
34
|
packages = ["src/ImagePRO"]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from insightface.app import FaceAnalysis
|
|
2
|
+
import cv2
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
def compare_faces(src_image_path_1, src_image_path_2, app=None):
|
|
6
|
+
"""
|
|
7
|
+
Compare two face images using FaceAnalysis embeddings.
|
|
8
|
+
|
|
9
|
+
This function calculates the cosine similarity between the embeddings
|
|
10
|
+
of two detected faces to check if they belong to the same person.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
src_image_path_1 (str | Path): Path to the first image.
|
|
14
|
+
src_image_path_2 (str | Path): Path to the second image.
|
|
15
|
+
app (FaceAnalysis, optional): Pre-loaded FaceAnalysis model instance.
|
|
16
|
+
If not provided, it will be initialized inside the function.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool | str:
|
|
20
|
+
- True : Faces match (cosine similarity > 0.5).
|
|
21
|
+
- False : Faces do not match.
|
|
22
|
+
- 'No Face Detected' : If no face is found in either image.
|
|
23
|
+
"""
|
|
24
|
+
# Prepare FaceAnalysis model if not provided
|
|
25
|
+
if app is None:
|
|
26
|
+
app = FaceAnalysis(
|
|
27
|
+
name="buffalo_l",
|
|
28
|
+
providers=["CPUExecutionProvider"],
|
|
29
|
+
)
|
|
30
|
+
app.prepare(ctx_id=0) # Run on CPU
|
|
31
|
+
|
|
32
|
+
# Helper function to read an image and convert to RGB
|
|
33
|
+
def load_rgb(path):
|
|
34
|
+
img = cv2.imread(str(path))
|
|
35
|
+
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB) if img is not None else None
|
|
36
|
+
|
|
37
|
+
# Load and preprocess both images
|
|
38
|
+
img1 = load_rgb(src_image_path_1)
|
|
39
|
+
img2 = load_rgb(src_image_path_2)
|
|
40
|
+
|
|
41
|
+
if img1 is None or img2 is None:
|
|
42
|
+
return 'Invalid Image Path'
|
|
43
|
+
|
|
44
|
+
# Detect faces in both images
|
|
45
|
+
faces1 = app.get(img1)
|
|
46
|
+
faces2 = app.get(img2)
|
|
47
|
+
|
|
48
|
+
# Ensure a face was detected in both images
|
|
49
|
+
if not faces1 or not faces2:
|
|
50
|
+
return 'No Face Detected'
|
|
51
|
+
|
|
52
|
+
# Get the embeddings of the first detected face in each image
|
|
53
|
+
emb1 = faces1[0].embedding
|
|
54
|
+
emb2 = faces2[0].embedding
|
|
55
|
+
|
|
56
|
+
# Compute cosine similarity between the embeddings
|
|
57
|
+
sim = np.dot(emb1, emb2) / (np.linalg.norm(emb1) * np.linalg.norm(emb2))
|
|
58
|
+
|
|
59
|
+
# Return match result based on threshold
|
|
60
|
+
return True if sim > 0.5 else False
|
{imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/pre_processing/dataset_generator.py
RENAMED
|
@@ -127,7 +127,7 @@ def capture_bulk_pictures(
|
|
|
127
127
|
if apply_grayscale:
|
|
128
128
|
proc = convert_to_grayscale(src_np_image=proc)
|
|
129
129
|
|
|
130
|
-
if apply_resize is not
|
|
130
|
+
if apply_resize is not False:
|
|
131
131
|
proc = resize_image(new_size=apply_resize, src_np_image=proc)
|
|
132
132
|
|
|
133
133
|
if apply_rotate:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ImagePRO-Python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: clean, modular, and easy-to-use Python library for image processing tasks.
|
|
5
5
|
Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -16,4 +16,5 @@ Requires-Dist: numpy<3.0,>=1.24
|
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
17
|
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
18
|
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
19
|
+
Requires-Dist: insightface<1.0,>=0.7
|
|
19
20
|
Dynamic: license-file
|
|
@@ -7,6 +7,7 @@ src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py
|
|
|
7
7
|
src/ImagePRO/human_analysis/body_analysis/hand_tracking.py
|
|
8
8
|
src/ImagePRO/human_analysis/face_analysis/__init__.py
|
|
9
9
|
src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py
|
|
10
|
+
src/ImagePRO/human_analysis/face_analysis/face_comparison.py
|
|
10
11
|
src/ImagePRO/human_analysis/face_analysis/face_detection.py
|
|
11
12
|
src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py
|
|
12
13
|
src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO/object_analysis/object_detection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.4.0 → imagepro_python-0.5.0}/src/ImagePRO_Python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|