ImagePRO-Python 0.3.0__tar.gz → 0.4.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.3.0/src/ImagePRO_Python.egg-info → imagepro_python-0.4.0}/PKG-INFO +3 -1
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/pyproject.toml +3 -1
- imagepro_python-0.4.0/src/ImagePRO/object_analysis/object_detection.py +98 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0/src/ImagePRO_Python.egg-info}/PKG-INFO +3 -1
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO_Python.egg-info/SOURCES.txt +1 -0
- imagepro_python-0.4.0/src/ImagePRO_Python.egg-info/requires.txt +4 -0
- imagepro_python-0.3.0/src/ImagePRO_Python.egg-info/requires.txt +0 -2
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/LICENSE +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/setup.cfg +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/body_analysis/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/body_analysis/hand_tracking.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/face_analysis/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/face_analysis/face_detection.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/blur.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/contrast.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/crop.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/dataset_generator.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/grayscale.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/resize.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/rotate.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/sharpen.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/utils/__init__.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/utils/io_handler.py +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO_Python.egg-info/dependency_links.txt +0 -0
- {imagepro_python-0.3.0 → imagepro_python-0.4.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.4.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
|
|
@@ -14,4 +14,6 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: numpy<3.0,>=1.24
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
|
+
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
|
+
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
17
19
|
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.4.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.*"
|
|
@@ -24,6 +24,8 @@ classifiers = [
|
|
|
24
24
|
dependencies = [
|
|
25
25
|
"numpy>=1.24,<3.0",
|
|
26
26
|
"opencv-python>=4.8,<5.0",
|
|
27
|
+
"ultralytics>=8.2.0,<9.0",
|
|
28
|
+
"mediapipe>=0.10.0,<1.0",
|
|
27
29
|
]
|
|
28
30
|
|
|
29
31
|
[tool.hatch.build.targets.wheel]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from ultralytics import YOLO
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
# Add parent directory to path for custom module imports
|
|
6
|
+
parent_dir = Path(__file__).resolve().parent.parent
|
|
7
|
+
sys.path.append(str(parent_dir))
|
|
8
|
+
|
|
9
|
+
from utils.io_handler import IOHandler
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def detect_objects(
|
|
13
|
+
model=None,
|
|
14
|
+
accuracy_level=1,
|
|
15
|
+
src_image_path=None,
|
|
16
|
+
src_np_image=None,
|
|
17
|
+
output_image_path=None,
|
|
18
|
+
output_csv_path=None,
|
|
19
|
+
show_result=False
|
|
20
|
+
):
|
|
21
|
+
"""
|
|
22
|
+
Run object detection on a single image using Ultralytics YOLO.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
model : ultralytics.engine.model.YOLO | None, optional
|
|
27
|
+
A pre-loaded YOLO model instance. If provided, `accuracy_level` is ignored.
|
|
28
|
+
If None, a model is created based on `accuracy_level`.
|
|
29
|
+
accuracy_level : int, default=1
|
|
30
|
+
Model size preset in {1..5} mapping to:
|
|
31
|
+
1 -> "yolo11n.pt", 2 -> "yolo11s.pt", 3 -> "yolo11m.pt",
|
|
32
|
+
4 -> "yolo11l.pt", 5 -> "yolo11x.pt".
|
|
33
|
+
src_image_path : str | None, optional
|
|
34
|
+
Path to the input image on disk. Used by IOHandler if `src_np_image` is None.
|
|
35
|
+
src_np_image : np.ndarray | None, optional
|
|
36
|
+
Image array (BGR). If provided, it is preferred over `src_image_path`.
|
|
37
|
+
output_image_path : str | None, optional
|
|
38
|
+
If provided, saves the annotated image (result.plot()) to this path.
|
|
39
|
+
output_csv_path : str | None, optional
|
|
40
|
+
If provided, saves detections as rows of `[class_id, [x1n, y1n, x2n, y2n], confidence]`.
|
|
41
|
+
Note: coordinates are normalized in [0, 1].
|
|
42
|
+
show_result : bool, default=False
|
|
43
|
+
If True, shows the result window via `result.show()` (may require a GUI environment).
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
tuple
|
|
48
|
+
(annotated_image: np.ndarray, lines: list[list])
|
|
49
|
+
where `annotated_image` is the result of `result.plot()` and
|
|
50
|
+
`lines` is a list of detection rows saved to CSV when requested.
|
|
51
|
+
|
|
52
|
+
Raises
|
|
53
|
+
------
|
|
54
|
+
ValueError
|
|
55
|
+
If `accuracy_level` is not in {1..5}, or if image loading fails inside IOHandler.
|
|
56
|
+
"""
|
|
57
|
+
# Create a model from preset if not provided by caller
|
|
58
|
+
if model is None:
|
|
59
|
+
if accuracy_level == 1:
|
|
60
|
+
model_name = "yolo11n.pt"
|
|
61
|
+
elif accuracy_level == 2:
|
|
62
|
+
model_name = "yolo11s.pt"
|
|
63
|
+
elif accuracy_level == 3:
|
|
64
|
+
model_name = "yolo11m.pt"
|
|
65
|
+
elif accuracy_level == 4:
|
|
66
|
+
model_name = "yolo11l.pt"
|
|
67
|
+
elif accuracy_level == 5:
|
|
68
|
+
model_name = "yolo11x.pt"
|
|
69
|
+
else:
|
|
70
|
+
raise ValueError('Unknown accuracy level.')
|
|
71
|
+
|
|
72
|
+
model = YOLO(model=model_name)
|
|
73
|
+
|
|
74
|
+
# Load image from path or ndarray using the shared IO helper
|
|
75
|
+
frame = IOHandler.load_image(image_path=src_image_path, np_image=src_np_image)
|
|
76
|
+
|
|
77
|
+
# Run inference (first result only)
|
|
78
|
+
result = model(frame)[0]
|
|
79
|
+
boxes = result.boxes
|
|
80
|
+
|
|
81
|
+
# Collect rows as: [class_id, [x1n, y1n, x2n, y2n], confidence]
|
|
82
|
+
lines = []
|
|
83
|
+
for box in boxes:
|
|
84
|
+
box_class = int(box.cls)
|
|
85
|
+
conf = float(box.conf)
|
|
86
|
+
x1, y1, x2, y2 = [float(c) for c in box.xyxyn.squeeze().tolist()]
|
|
87
|
+
lines.append([box_class, [x1, y1, x2, y2], conf])
|
|
88
|
+
|
|
89
|
+
# Optional visualization and saving
|
|
90
|
+
if show_result:
|
|
91
|
+
result.show()
|
|
92
|
+
if output_image_path:
|
|
93
|
+
IOHandler.save_image(np_image=result.plot(), result_path=output_image_path)
|
|
94
|
+
if output_csv_path:
|
|
95
|
+
IOHandler.save_csv(data=lines, result_path=output_csv_path)
|
|
96
|
+
|
|
97
|
+
# Return the plotted image and the CSV-friendly rows
|
|
98
|
+
return result.plot(), lines
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ImagePRO-Python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -14,4 +14,6 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: numpy<3.0,>=1.24
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
|
+
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
|
+
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
17
19
|
Dynamic: license-file
|
|
@@ -10,6 +10,7 @@ src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py
|
|
|
10
10
|
src/ImagePRO/human_analysis/face_analysis/face_detection.py
|
|
11
11
|
src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py
|
|
12
12
|
src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py
|
|
13
|
+
src/ImagePRO/object_analysis/object_detection.py
|
|
13
14
|
src/ImagePRO/pre_processing/__init__.py
|
|
14
15
|
src/ImagePRO/pre_processing/blur.py
|
|
15
16
|
src/ImagePRO/pre_processing/contrast.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO/pre_processing/dataset_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.3.0 → imagepro_python-0.4.0}/src/ImagePRO_Python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|