eye-cv 1.0.0__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.
- eye/__init__.py +115 -0
- eye/__init___supervision_original.py +120 -0
- eye/annotators/__init__.py +0 -0
- eye/annotators/base.py +22 -0
- eye/annotators/core.py +2699 -0
- eye/annotators/line.py +107 -0
- eye/annotators/modern.py +529 -0
- eye/annotators/trace.py +142 -0
- eye/annotators/utils.py +177 -0
- eye/assets/__init__.py +2 -0
- eye/assets/downloader.py +95 -0
- eye/assets/list.py +83 -0
- eye/classification/__init__.py +0 -0
- eye/classification/core.py +188 -0
- eye/config.py +2 -0
- eye/core/__init__.py +0 -0
- eye/core/trackers/__init__.py +1 -0
- eye/core/trackers/botsort_tracker.py +336 -0
- eye/core/trackers/bytetrack_tracker.py +284 -0
- eye/core/trackers/sort_tracker.py +200 -0
- eye/core/tracking.py +146 -0
- eye/dataset/__init__.py +0 -0
- eye/dataset/core.py +919 -0
- eye/dataset/formats/__init__.py +0 -0
- eye/dataset/formats/coco.py +258 -0
- eye/dataset/formats/pascal_voc.py +279 -0
- eye/dataset/formats/yolo.py +272 -0
- eye/dataset/utils.py +259 -0
- eye/detection/__init__.py +0 -0
- eye/detection/auto_convert.py +155 -0
- eye/detection/core.py +1529 -0
- eye/detection/detections_enhanced.py +392 -0
- eye/detection/line_zone.py +859 -0
- eye/detection/lmm.py +184 -0
- eye/detection/overlap_filter.py +270 -0
- eye/detection/tools/__init__.py +0 -0
- eye/detection/tools/csv_sink.py +181 -0
- eye/detection/tools/inference_slicer.py +288 -0
- eye/detection/tools/json_sink.py +142 -0
- eye/detection/tools/polygon_zone.py +202 -0
- eye/detection/tools/smoother.py +123 -0
- eye/detection/tools/smoothing.py +179 -0
- eye/detection/tools/smoothing_config.py +202 -0
- eye/detection/tools/transformers.py +247 -0
- eye/detection/utils.py +1175 -0
- eye/draw/__init__.py +0 -0
- eye/draw/color.py +154 -0
- eye/draw/utils.py +374 -0
- eye/filters.py +112 -0
- eye/geometry/__init__.py +0 -0
- eye/geometry/core.py +128 -0
- eye/geometry/utils.py +47 -0
- eye/keypoint/__init__.py +0 -0
- eye/keypoint/annotators.py +442 -0
- eye/keypoint/core.py +687 -0
- eye/keypoint/skeletons.py +2647 -0
- eye/metrics/__init__.py +21 -0
- eye/metrics/core.py +72 -0
- eye/metrics/detection.py +843 -0
- eye/metrics/f1_score.py +648 -0
- eye/metrics/mean_average_precision.py +628 -0
- eye/metrics/mean_average_recall.py +697 -0
- eye/metrics/precision.py +653 -0
- eye/metrics/recall.py +652 -0
- eye/metrics/utils/__init__.py +0 -0
- eye/metrics/utils/object_size.py +158 -0
- eye/metrics/utils/utils.py +9 -0
- eye/py.typed +0 -0
- eye/quick.py +104 -0
- eye/tracker/__init__.py +0 -0
- eye/tracker/byte_tracker/__init__.py +0 -0
- eye/tracker/byte_tracker/core.py +386 -0
- eye/tracker/byte_tracker/kalman_filter.py +205 -0
- eye/tracker/byte_tracker/matching.py +69 -0
- eye/tracker/byte_tracker/single_object_track.py +178 -0
- eye/tracker/byte_tracker/utils.py +18 -0
- eye/utils/__init__.py +0 -0
- eye/utils/conversion.py +132 -0
- eye/utils/file.py +159 -0
- eye/utils/image.py +794 -0
- eye/utils/internal.py +200 -0
- eye/utils/iterables.py +84 -0
- eye/utils/notebook.py +114 -0
- eye/utils/video.py +307 -0
- eye/utils_eye/__init__.py +1 -0
- eye/utils_eye/geometry.py +71 -0
- eye/utils_eye/nms.py +55 -0
- eye/validators/__init__.py +140 -0
- eye/web.py +271 -0
- eye_cv-1.0.0.dist-info/METADATA +319 -0
- eye_cv-1.0.0.dist-info/RECORD +94 -0
- eye_cv-1.0.0.dist-info/WHEEL +5 -0
- eye_cv-1.0.0.dist-info/licenses/LICENSE +21 -0
- eye_cv-1.0.0.dist-info/top_level.txt +1 -0
eye/__init__.py
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""Public API surface for Eye.
|
|
2
|
+
|
|
3
|
+
This module intentionally avoids importing optional dependencies at import-time.
|
|
4
|
+
Most symbols are provided via lazy attribute loading (PEP 562) so that `import eye`
|
|
5
|
+
works with only the core dependencies installed.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import importlib
|
|
11
|
+
import importlib.metadata as importlib_metadata
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
__version__ = importlib_metadata.version(__package__ or __name__)
|
|
16
|
+
except importlib_metadata.PackageNotFoundError: # pragma: no cover
|
|
17
|
+
__version__ = "development"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
_EXPORTS: dict[str, tuple[str, str]] = {
|
|
21
|
+
# Detection conversion
|
|
22
|
+
"auto_convert": ("eye.detection.auto_convert", "auto_convert"),
|
|
23
|
+
"from_yolo": ("eye.detection.auto_convert", "from_yolo"),
|
|
24
|
+
"from_pytorch": ("eye.detection.auto_convert", "from_pytorch"),
|
|
25
|
+
"from_tensorflow": ("eye.detection.auto_convert", "from_tensorflow"),
|
|
26
|
+
"from_opencv": ("eye.detection.auto_convert", "from_opencv"),
|
|
27
|
+
|
|
28
|
+
# Core data structures
|
|
29
|
+
"Detections": ("eye.detection.core", "Detections"),
|
|
30
|
+
"Classifications": ("eye.classification.core", "Classifications"),
|
|
31
|
+
|
|
32
|
+
# Tracking
|
|
33
|
+
"Tracker": ("eye.core.tracking", "Tracker"),
|
|
34
|
+
"TrackerType": ("eye.core.tracking", "TrackerType"),
|
|
35
|
+
"ByteTrack": ("eye.tracker.byte_tracker.core", "ByteTrack"),
|
|
36
|
+
|
|
37
|
+
# Smoothing
|
|
38
|
+
"KalmanSmoothing": ("eye.detection.tools.smoothing", "KalmanSmoothing"),
|
|
39
|
+
"ExponentialSmoothing": ("eye.detection.tools.smoothing", "ExponentialSmoothing"),
|
|
40
|
+
"smooth_detections": ("eye.detection.tools.smoothing", "smooth_detections"),
|
|
41
|
+
"SmoothingConfig": ("eye.detection.tools.smoothing_config", "SmoothingConfig"),
|
|
42
|
+
"SmoothingPreset": ("eye.detection.tools.smoothing_config", "SmoothingPreset"),
|
|
43
|
+
"get_smoothing_guide": ("eye.detection.tools.smoothing_config", "get_smoothing_guide"),
|
|
44
|
+
|
|
45
|
+
# Zones / tools
|
|
46
|
+
"PolygonZone": ("eye.detection.tools.polygon_zone", "PolygonZone"),
|
|
47
|
+
"PolygonZoneAnnotator": ("eye.detection.tools.polygon_zone", "PolygonZoneAnnotator"),
|
|
48
|
+
"LineZone": ("eye.detection.line_zone", "LineZone"),
|
|
49
|
+
"LineZoneAnnotator": ("eye.detection.line_zone", "LineZoneAnnotator"),
|
|
50
|
+
"LineZoneAnnotatorMulticlass": ("eye.detection.line_zone", "LineZoneAnnotatorMulticlass"),
|
|
51
|
+
|
|
52
|
+
# Video
|
|
53
|
+
"VideoInfo": ("eye.utils.video", "VideoInfo"),
|
|
54
|
+
"VideoWriter": ("eye.utils.video", "VideoWriter"),
|
|
55
|
+
"VideoSink": ("eye.utils.video", "VideoSink"),
|
|
56
|
+
"FPSMonitor": ("eye.utils.video", "FPSMonitor"),
|
|
57
|
+
"get_video_frames_generator": ("eye.utils.video", "get_video_frames_generator"),
|
|
58
|
+
"process_video": ("eye.utils.video", "process_video"),
|
|
59
|
+
|
|
60
|
+
# Common annotators
|
|
61
|
+
"BoxAnnotator": ("eye.annotators.core", "BoxAnnotator"),
|
|
62
|
+
"TraceAnnotator": ("eye.annotators.core", "TraceAnnotator"),
|
|
63
|
+
"BoxCornerAnnotator": ("eye.annotators.core", "BoxCornerAnnotator"),
|
|
64
|
+
"BoundingBoxAnnotator": ("eye.annotators.core", "BoundingBoxAnnotator"),
|
|
65
|
+
"LabelAnnotator": ("eye.annotators.core", "LabelAnnotator"),
|
|
66
|
+
"MaskAnnotator": ("eye.annotators.core", "MaskAnnotator"),
|
|
67
|
+
"HeatMapAnnotator": ("eye.annotators.core", "HeatMapAnnotator"),
|
|
68
|
+
"ColorLookup": ("eye.annotators.utils", "ColorLookup"),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
_MODERN_EXPORTS = {
|
|
73
|
+
"GradientBoxAnnotator",
|
|
74
|
+
"NeonTraceAnnotator",
|
|
75
|
+
"ShadowBoxAnnotator",
|
|
76
|
+
"CornerBoxAnnotator",
|
|
77
|
+
"FPSAnnotator",
|
|
78
|
+
"InfoAnnotator",
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
__all__ = sorted({"__version__", *_EXPORTS.keys(), *_MODERN_EXPORTS})
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def __getattr__(name: str) -> Any: # PEP 562
|
|
86
|
+
if name in _EXPORTS:
|
|
87
|
+
module_name, attr_name = _EXPORTS[name]
|
|
88
|
+
module = importlib.import_module(module_name)
|
|
89
|
+
value = getattr(module, attr_name)
|
|
90
|
+
globals()[name] = value
|
|
91
|
+
return value
|
|
92
|
+
|
|
93
|
+
if name in _MODERN_EXPORTS:
|
|
94
|
+
try:
|
|
95
|
+
module = importlib.import_module("eye.annotators.modern")
|
|
96
|
+
value = getattr(module, name)
|
|
97
|
+
except Exception:
|
|
98
|
+
# Keep the same behavior as the old eager-import version.
|
|
99
|
+
if name == "GradientBoxAnnotator":
|
|
100
|
+
value = __getattr__("BoxAnnotator")
|
|
101
|
+
elif name == "NeonTraceAnnotator":
|
|
102
|
+
value = __getattr__("TraceAnnotator")
|
|
103
|
+
elif name == "ShadowBoxAnnotator":
|
|
104
|
+
value = __getattr__("BoxAnnotator")
|
|
105
|
+
elif name == "CornerBoxAnnotator":
|
|
106
|
+
value = __getattr__("BoxCornerAnnotator")
|
|
107
|
+
elif name in {"FPSAnnotator", "InfoAnnotator"}:
|
|
108
|
+
value = None
|
|
109
|
+
else:
|
|
110
|
+
raise
|
|
111
|
+
|
|
112
|
+
globals()[name] = value
|
|
113
|
+
return value
|
|
114
|
+
|
|
115
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import importlib.metadata as importlib_metadata
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
# This will read version from pyproject.toml
|
|
5
|
+
__version__ = importlib_metadata.version(__package__ or __name__)
|
|
6
|
+
except importlib_metadata.PackageNotFoundError:
|
|
7
|
+
__version__ = "development"
|
|
8
|
+
|
|
9
|
+
from eye.annotators.core import (
|
|
10
|
+
BackgroundOverlayAnnotator,
|
|
11
|
+
BlurAnnotator,
|
|
12
|
+
BoundingBoxAnnotator,
|
|
13
|
+
BoxAnnotator,
|
|
14
|
+
BoxCornerAnnotator,
|
|
15
|
+
CircleAnnotator,
|
|
16
|
+
ColorAnnotator,
|
|
17
|
+
CropAnnotator,
|
|
18
|
+
DotAnnotator,
|
|
19
|
+
EllipseAnnotator,
|
|
20
|
+
HaloAnnotator,
|
|
21
|
+
HeatMapAnnotator,
|
|
22
|
+
IconAnnotator,
|
|
23
|
+
LabelAnnotator,
|
|
24
|
+
MaskAnnotator,
|
|
25
|
+
OrientedBoxAnnotator,
|
|
26
|
+
PercentageBarAnnotator,
|
|
27
|
+
PixelateAnnotator,
|
|
28
|
+
PolygonAnnotator,
|
|
29
|
+
RichLabelAnnotator,
|
|
30
|
+
RoundBoxAnnotator,
|
|
31
|
+
TraceAnnotator,
|
|
32
|
+
TriangleAnnotator,
|
|
33
|
+
)
|
|
34
|
+
from eye.annotators.utils import ColorLookup
|
|
35
|
+
from eye.classification.core import Classifications
|
|
36
|
+
from eye.dataset.core import (
|
|
37
|
+
BaseDataset,
|
|
38
|
+
ClassificationDataset,
|
|
39
|
+
DetectionDataset,
|
|
40
|
+
)
|
|
41
|
+
from eye.dataset.utils import mask_to_rle, rle_to_mask
|
|
42
|
+
from eye.detection.core import Detections
|
|
43
|
+
from eye.detection.line_zone import (
|
|
44
|
+
LineZone,
|
|
45
|
+
LineZoneAnnotator,
|
|
46
|
+
LineZoneAnnotatorMulticlass,
|
|
47
|
+
)
|
|
48
|
+
from eye.detection.lmm import LMM
|
|
49
|
+
from eye.detection.overlap_filter import (
|
|
50
|
+
OverlapFilter,
|
|
51
|
+
box_non_max_merge,
|
|
52
|
+
box_non_max_suppression,
|
|
53
|
+
mask_non_max_suppression,
|
|
54
|
+
)
|
|
55
|
+
from eye.detection.tools.csv_sink import CSVSink
|
|
56
|
+
from eye.detection.tools.inference_slicer import InferenceSlicer
|
|
57
|
+
from eye.detection.tools.json_sink import JSONSink
|
|
58
|
+
from eye.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator
|
|
59
|
+
from eye.detection.tools.smoother import DetectionsSmoother
|
|
60
|
+
from eye.detection.utils import (
|
|
61
|
+
box_iou_batch,
|
|
62
|
+
calculate_masks_centroids,
|
|
63
|
+
clip_boxes,
|
|
64
|
+
contains_holes,
|
|
65
|
+
contains_multiple_segments,
|
|
66
|
+
filter_polygons_by_area,
|
|
67
|
+
mask_iou_batch,
|
|
68
|
+
mask_to_polygons,
|
|
69
|
+
mask_to_xyxy,
|
|
70
|
+
move_boxes,
|
|
71
|
+
move_masks,
|
|
72
|
+
oriented_box_iou_batch,
|
|
73
|
+
pad_boxes,
|
|
74
|
+
polygon_to_mask,
|
|
75
|
+
polygon_to_xyxy,
|
|
76
|
+
scale_boxes,
|
|
77
|
+
xcycwh_to_xyxy,
|
|
78
|
+
xywh_to_xyxy,
|
|
79
|
+
)
|
|
80
|
+
from eye.draw.color import Color, ColorPalette
|
|
81
|
+
from eye.draw.utils import (
|
|
82
|
+
calculate_optimal_line_thickness,
|
|
83
|
+
calculate_optimal_text_scale,
|
|
84
|
+
draw_filled_polygon,
|
|
85
|
+
draw_filled_rectangle,
|
|
86
|
+
draw_image,
|
|
87
|
+
draw_line,
|
|
88
|
+
draw_polygon,
|
|
89
|
+
draw_rectangle,
|
|
90
|
+
draw_text,
|
|
91
|
+
)
|
|
92
|
+
from eye.geometry.core import Point, Position, Rect
|
|
93
|
+
from eye.geometry.utils import get_polygon_center
|
|
94
|
+
from eye.keypoint.annotators import (
|
|
95
|
+
EdgeAnnotator,
|
|
96
|
+
VertexAnnotator,
|
|
97
|
+
VertexLabelAnnotator,
|
|
98
|
+
)
|
|
99
|
+
from eye.keypoint.core import KeyPoints
|
|
100
|
+
from eye.metrics.detection import ConfusionMatrix, MeanAveragePrecision
|
|
101
|
+
from eye.tracker.byte_tracker.core import ByteTrack
|
|
102
|
+
from eye.utils.conversion import cv2_to_pillow, pillow_to_cv2
|
|
103
|
+
from eye.utils.file import list_files_with_extensions
|
|
104
|
+
from eye.utils.image import (
|
|
105
|
+
ImageSink,
|
|
106
|
+
create_tiles,
|
|
107
|
+
crop_image,
|
|
108
|
+
letterbox_image,
|
|
109
|
+
overlay_image,
|
|
110
|
+
resize_image,
|
|
111
|
+
scale_image,
|
|
112
|
+
)
|
|
113
|
+
from eye.utils.notebook import plot_image, plot_images_grid
|
|
114
|
+
from eye.utils.video import (
|
|
115
|
+
FPSMonitor,
|
|
116
|
+
VideoInfo,
|
|
117
|
+
VideoSink,
|
|
118
|
+
get_video_frames_generator,
|
|
119
|
+
process_video,
|
|
120
|
+
)
|
|
File without changes
|
eye/annotators/base.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import TypeVar
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from PIL import Image
|
|
6
|
+
|
|
7
|
+
from eye.detection.core import Detections
|
|
8
|
+
|
|
9
|
+
ImageType = TypeVar("ImageType", np.ndarray, Image.Image)
|
|
10
|
+
"""
|
|
11
|
+
An image of type `np.ndarray` or `PIL.Image.Image`.
|
|
12
|
+
|
|
13
|
+
Unlike a `Union`, ensures the type remains consistent. If a function
|
|
14
|
+
takes an `ImageType` argument and returns an `ImageType`, when you
|
|
15
|
+
pass an `np.ndarray`, you will get an `np.ndarray` back.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BaseAnnotator(ABC):
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def annotate(self, scene: ImageType, detections: Detections) -> ImageType:
|
|
22
|
+
pass
|