faster-coco-eval 1.6.7__tar.gz → 1.6.8__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.
- {faster_coco_eval-1.6.7/faster_coco_eval.egg-info → faster_coco_eval-1.6.8}/PKG-INFO +3 -9
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/core/coco.py +8 -3
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/core/mask.py +13 -3
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/display.py +6 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/draw.py +58 -6
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/utils.py +13 -5
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/version.py +1 -1
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8/faster_coco_eval.egg-info}/PKG-INFO +3 -9
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval.egg-info/requires.txt +2 -8
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/requirements/extra.txt +3 -0
- faster_coco_eval-1.6.8/requirements/runtime.txt +1 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_extra_draw.py +6 -2
- faster_coco_eval-1.6.7/requirements/runtime.txt +0 -4
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/LICENSE +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/MANIFEST.in +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/README.md +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/cocoeval.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/cocoeval.h +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/dataset.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/dataset.h +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/faster_eval_api.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/mask_api/mask_api.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/mask_api/src/mask.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/mask_api/src/mask.h +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/mask_api/src/rle.cpp +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/__init__.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/core/__init__.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/core/cocoeval.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/core/faster_eval_api.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/__init__.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/curves.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/extra/extra.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/__init__.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/__init__.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/coco_dataset.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/coco_eval.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval.egg-info/SOURCES.txt +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval.egg-info/dependency_links.txt +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval.egg-info/top_level.txt +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/pyproject.toml +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/requirements/docs.txt +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/requirements/tests.txt +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/setup.cfg +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/setup.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_basic.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_boundary.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_coco_metric.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_cocoapi_fake_data.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_crowdpose.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_dataset.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_init_pycocotools.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_keypoints.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_lvis_metric.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_mask_api.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_torchmetrics.py +0 -0
- {faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/tests/test_world_evalutor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: faster-coco-eval
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.8
|
|
4
4
|
Summary: Faster interpretation of the original COCOEval
|
|
5
5
|
Home-page: https://github.com/MiXaiLL76/faster_coco_eval
|
|
6
6
|
Author: MiXaiLL76
|
|
@@ -20,20 +20,14 @@ Requires-Python: >=3.7
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: numpy
|
|
23
|
-
Requires-Dist: plotly
|
|
24
|
-
Requires-Dist: pandas
|
|
25
|
-
Requires-Dist: Pillow
|
|
26
23
|
Provides-Extra: extra
|
|
27
24
|
Requires-Dist: numpy; extra == "extra"
|
|
28
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: opencv-python-headless; extra == "extra"
|
|
29
26
|
Requires-Dist: pandas; extra == "extra"
|
|
27
|
+
Requires-Dist: plotly; extra == "extra"
|
|
30
28
|
Requires-Dist: Pillow; extra == "extra"
|
|
31
|
-
Requires-Dist: opencv-python-headless; extra == "extra"
|
|
32
29
|
Provides-Extra: tests
|
|
33
30
|
Requires-Dist: numpy; extra == "tests"
|
|
34
|
-
Requires-Dist: plotly; extra == "tests"
|
|
35
|
-
Requires-Dist: pandas; extra == "tests"
|
|
36
|
-
Requires-Dist: Pillow; extra == "tests"
|
|
37
31
|
Requires-Dist: numpy; extra == "tests"
|
|
38
32
|
Requires-Dist: pycocotools; python_version < "3.13" and extra == "tests"
|
|
39
33
|
Requires-Dist: pytest; extra == "tests"
|
|
@@ -425,9 +425,14 @@ class COCO:
|
|
|
425
425
|
raise Exception("datasetType not supported")
|
|
426
426
|
|
|
427
427
|
if datasetType == "instances":
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
try:
|
|
429
|
+
import matplotlib.pyplot as plt
|
|
430
|
+
from matplotlib.collections import PatchCollection
|
|
431
|
+
from matplotlib.patches import Polygon
|
|
432
|
+
except ImportError:
|
|
433
|
+
message = "Missing dependencies: matplotlib\n"
|
|
434
|
+
message += "Use: pip install matplotlib"
|
|
435
|
+
raise ImportError(message)
|
|
431
436
|
|
|
432
437
|
ax = plt.gca()
|
|
433
438
|
ax.set_autoscale_on(False)
|
|
@@ -4,14 +4,24 @@ from typing import Dict, List, Union
|
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
|
+
import faster_coco_eval.mask_api_new_cpp as _mask
|
|
8
|
+
|
|
7
9
|
try:
|
|
8
10
|
import cv2
|
|
9
11
|
|
|
10
12
|
opencv_available = True
|
|
11
13
|
except ImportError:
|
|
14
|
+
cv2 = None
|
|
12
15
|
opencv_available = False
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
def _check_opencv():
|
|
19
|
+
"""Check if OpenCV is available and raise informative error."""
|
|
20
|
+
if not opencv_available:
|
|
21
|
+
message = "Missing dependency: opencv-python\n"
|
|
22
|
+
message += "Use: pip install faster-coco-eval[extra]"
|
|
23
|
+
raise ImportError(message)
|
|
24
|
+
|
|
15
25
|
|
|
16
26
|
ValidRleType = Union[List[np.ndarray], List[List[float]], np.ndarray, List[dict]]
|
|
17
27
|
|
|
@@ -40,6 +50,8 @@ def rleToBoundaryCV(rle: dict, dilation_ratio: float = 0.02) -> dict:
|
|
|
40
50
|
Returns:
|
|
41
51
|
dict: Run-length encoding of the boundary mask.
|
|
42
52
|
"""
|
|
53
|
+
_check_opencv()
|
|
54
|
+
|
|
43
55
|
mask = _mask.decode([rle])[:, :, 0]
|
|
44
56
|
h, w = rle["size"]
|
|
45
57
|
|
|
@@ -81,8 +93,6 @@ def rleToBoundary(
|
|
|
81
93
|
if backend == "mask_api":
|
|
82
94
|
return _mask.toBoundary([rle], dilation_ratio)[0]
|
|
83
95
|
else:
|
|
84
|
-
if not opencv_available:
|
|
85
|
-
raise ImportError("OpenCV is not available. Please install OpenCV to use this function.")
|
|
86
96
|
return rleToBoundaryCV(rle, dilation_ratio)
|
|
87
97
|
|
|
88
98
|
|
|
@@ -17,6 +17,7 @@ class PreviewResults(ExtraEval):
|
|
|
17
17
|
display_fn: bool = True,
|
|
18
18
|
display_tp: bool = True,
|
|
19
19
|
display_gt: bool = True,
|
|
20
|
+
show_false_only: bool = False,
|
|
20
21
|
data_folder: Optional[str] = None,
|
|
21
22
|
categories: Optional[list] = None,
|
|
22
23
|
gt_ann_ids: Optional[set] = None,
|
|
@@ -31,6 +32,7 @@ class PreviewResults(ExtraEval):
|
|
|
31
32
|
display_fn (bool): Display false negatives.
|
|
32
33
|
display_tp (bool): Display true positives.
|
|
33
34
|
display_gt (bool): Display ground truth.
|
|
35
|
+
show_false_only (bool): If True, only display images that contains false positives or false negatives.
|
|
34
36
|
data_folder (Optional[str]): Data folder.
|
|
35
37
|
categories (Optional[list]): Categories to display.
|
|
36
38
|
gt_ann_ids (Optional[set]): Ground truth annotation ids.
|
|
@@ -49,6 +51,7 @@ class PreviewResults(ExtraEval):
|
|
|
49
51
|
display_fn=display_fn,
|
|
50
52
|
display_tp=display_tp,
|
|
51
53
|
display_gt=display_gt,
|
|
54
|
+
show_false_only=show_false_only,
|
|
52
55
|
data_folder=data_folder,
|
|
53
56
|
categories=categories,
|
|
54
57
|
gt_ann_ids=gt_ann_ids,
|
|
@@ -63,6 +66,7 @@ class PreviewResults(ExtraEval):
|
|
|
63
66
|
display_fn: bool = True,
|
|
64
67
|
display_tp: bool = True,
|
|
65
68
|
display_gt: bool = False,
|
|
69
|
+
show_false_only: bool = False,
|
|
66
70
|
data_folder: Optional[str] = None,
|
|
67
71
|
categories: Optional[list] = None,
|
|
68
72
|
):
|
|
@@ -75,6 +79,7 @@ class PreviewResults(ExtraEval):
|
|
|
75
79
|
display_fn (bool): Display false negatives.
|
|
76
80
|
display_tp (bool): Display true positives.
|
|
77
81
|
display_gt (bool): Display ground truth.
|
|
82
|
+
show_false_only (bool): If True, only display images that contains false positives or false negatives.
|
|
78
83
|
data_folder (Optional[str]): Data folder.
|
|
79
84
|
categories (Optional[list]): Categories to display.
|
|
80
85
|
|
|
@@ -95,6 +100,7 @@ class PreviewResults(ExtraEval):
|
|
|
95
100
|
display_fn=display_fn,
|
|
96
101
|
display_tp=display_tp,
|
|
97
102
|
display_gt=display_gt,
|
|
103
|
+
show_false_only=show_false_only,
|
|
98
104
|
data_folder=data_folder,
|
|
99
105
|
categories=categories,
|
|
100
106
|
)
|
|
@@ -11,13 +11,44 @@ else:
|
|
|
11
11
|
showAnnsiouTypeT = str
|
|
12
12
|
|
|
13
13
|
import numpy as np
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
import plotly.express as px
|
|
17
|
+
import plotly.graph_objs as go
|
|
18
|
+
|
|
19
|
+
plotly_available = True
|
|
20
|
+
except ImportError:
|
|
21
|
+
px = None
|
|
22
|
+
go = None
|
|
23
|
+
plotly_available = False
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
from PIL import Image
|
|
27
|
+
|
|
28
|
+
pillow_available = True
|
|
29
|
+
except ImportError:
|
|
30
|
+
Image = None
|
|
31
|
+
pillow_available = False
|
|
17
32
|
|
|
18
33
|
from ..core import COCO
|
|
19
34
|
from .utils import convert_ann_rle_to_poly
|
|
20
35
|
|
|
36
|
+
|
|
37
|
+
def _check_dependencies(*deps):
|
|
38
|
+
"""Check if required dependencies are available and raise informative
|
|
39
|
+
error."""
|
|
40
|
+
missing = []
|
|
41
|
+
if "plotly" in deps and not plotly_available:
|
|
42
|
+
missing.append("plotly")
|
|
43
|
+
if "pillow" in deps and not pillow_available:
|
|
44
|
+
missing.append("Pillow")
|
|
45
|
+
|
|
46
|
+
if missing:
|
|
47
|
+
message = f"Missing dependencies: {', '.join(missing)}\n"
|
|
48
|
+
message += "Use: pip install faster-coco-eval[extra]"
|
|
49
|
+
raise ImportError(message)
|
|
50
|
+
|
|
51
|
+
|
|
21
52
|
logger = logging.getLogger(__name__)
|
|
22
53
|
|
|
23
54
|
A = 0.1
|
|
@@ -34,7 +65,7 @@ def generate_ann_polygon(
|
|
|
34
65
|
text: Optional[str] = None,
|
|
35
66
|
legendgroup: Optional[str] = None,
|
|
36
67
|
category_id_to_skeleton: Optional[dict] = None,
|
|
37
|
-
) -> go.Scatter:
|
|
68
|
+
) -> "go.Scatter":
|
|
38
69
|
"""Generate annotation polygon for plotly.
|
|
39
70
|
|
|
40
71
|
Args:
|
|
@@ -48,6 +79,8 @@ def generate_ann_polygon(
|
|
|
48
79
|
Returns:
|
|
49
80
|
go.Scatter: Plotly Scatter object representing the annotation polygon.
|
|
50
81
|
""" # noqa: E501
|
|
82
|
+
_check_dependencies("plotly")
|
|
83
|
+
|
|
51
84
|
all_x = []
|
|
52
85
|
all_y = []
|
|
53
86
|
|
|
@@ -111,12 +144,13 @@ def display_image(
|
|
|
111
144
|
display_fn: bool = True,
|
|
112
145
|
display_tp: bool = True,
|
|
113
146
|
display_gt: bool = True,
|
|
147
|
+
show_false_only: bool = False,
|
|
114
148
|
data_folder: Optional[str] = None,
|
|
115
149
|
categories: Optional[list] = None,
|
|
116
150
|
gt_ann_ids: Optional[set] = None,
|
|
117
151
|
dt_ann_ids: Optional[set] = None,
|
|
118
152
|
return_fig: bool = False,
|
|
119
|
-
) -> Optional[go.Figure]:
|
|
153
|
+
) -> Optional["go.Figure"]:
|
|
120
154
|
"""Display the image with the results.
|
|
121
155
|
|
|
122
156
|
Args:
|
|
@@ -128,6 +162,7 @@ def display_image(
|
|
|
128
162
|
display_fn (bool, optional): Display false negative annotations. Default is True.
|
|
129
163
|
display_tp (bool, optional): Display true positive annotations. Default is True.
|
|
130
164
|
display_gt (bool, optional): Display ground truth annotations. Default is True.
|
|
165
|
+
show_false_only (bool): If True, only display images that contains false positives or false negatives.
|
|
131
166
|
data_folder (str, optional): Folder containing the images. Default is None.
|
|
132
167
|
categories (list, optional): List of category ids to display. Default is None.
|
|
133
168
|
gt_ann_ids (set, optional): Set of ground truth annotation ids to display. Default is None.
|
|
@@ -137,7 +172,10 @@ def display_image(
|
|
|
137
172
|
Returns:
|
|
138
173
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
139
174
|
"""
|
|
175
|
+
_check_dependencies("plotly", "pillow")
|
|
176
|
+
|
|
140
177
|
polygons = []
|
|
178
|
+
contains_false = False
|
|
141
179
|
|
|
142
180
|
image = cocoGt.imgs[image_id]
|
|
143
181
|
gt_anns = {ann["id"]: ann for ann in cocoGt.imgToAnns[image_id]}
|
|
@@ -178,6 +216,7 @@ def display_image(
|
|
|
178
216
|
"category={}".format(categories_labels[ann["category_id"]]),
|
|
179
217
|
]
|
|
180
218
|
if ann.get("fn", False):
|
|
219
|
+
contains_false = True
|
|
181
220
|
if display_fn:
|
|
182
221
|
fn_text = ["<b>FN</b>"] + _text
|
|
183
222
|
poly = generate_ann_polygon(
|
|
@@ -233,6 +272,7 @@ def display_image(
|
|
|
233
272
|
if poly is not None:
|
|
234
273
|
polygons.append(poly)
|
|
235
274
|
else:
|
|
275
|
+
contains_false = True
|
|
236
276
|
if display_fp:
|
|
237
277
|
fp_text = ["<b>FP</b>"] + _text
|
|
238
278
|
|
|
@@ -247,6 +287,9 @@ def display_image(
|
|
|
247
287
|
if poly is not None:
|
|
248
288
|
polygons.append(poly)
|
|
249
289
|
|
|
290
|
+
if show_false_only and contains_false is False:
|
|
291
|
+
return None
|
|
292
|
+
|
|
250
293
|
fig = px.imshow(
|
|
251
294
|
im,
|
|
252
295
|
binary_compression_level=5,
|
|
@@ -286,7 +329,7 @@ def display_matrix(
|
|
|
286
329
|
labels: list,
|
|
287
330
|
normalize: bool = False,
|
|
288
331
|
return_fig: bool = False,
|
|
289
|
-
) -> Optional[go.Figure]:
|
|
332
|
+
) -> Optional["go.Figure"]:
|
|
290
333
|
"""Display the confusion matrix.
|
|
291
334
|
|
|
292
335
|
Args:
|
|
@@ -298,6 +341,7 @@ def display_matrix(
|
|
|
298
341
|
Returns:
|
|
299
342
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
300
343
|
"""
|
|
344
|
+
_check_dependencies("plotly")
|
|
301
345
|
|
|
302
346
|
_labels = labels + ["fp", "fn"]
|
|
303
347
|
|
|
@@ -362,6 +406,8 @@ def plot_pre_rec(curves, return_fig: bool = False):
|
|
|
362
406
|
Returns:
|
|
363
407
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
364
408
|
""" # noqa: E501
|
|
409
|
+
_check_dependencies("plotly")
|
|
410
|
+
|
|
365
411
|
fig = go.Figure()
|
|
366
412
|
|
|
367
413
|
for _curve in curves:
|
|
@@ -423,6 +469,8 @@ def plot_f1_confidence(curves, return_fig: bool = False):
|
|
|
423
469
|
Returns:
|
|
424
470
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
425
471
|
""" # noqa: E501
|
|
472
|
+
_check_dependencies("plotly")
|
|
473
|
+
|
|
426
474
|
fig = go.Figure()
|
|
427
475
|
eps = 1e-16
|
|
428
476
|
for _curve in curves:
|
|
@@ -485,6 +533,8 @@ def plot_ced_metric(curves, normalize: bool = False, return_fig: bool = False):
|
|
|
485
533
|
Returns:
|
|
486
534
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
487
535
|
""" # noqa: E501
|
|
536
|
+
_check_dependencies("plotly")
|
|
537
|
+
|
|
488
538
|
fig = go.Figure()
|
|
489
539
|
|
|
490
540
|
if normalize:
|
|
@@ -613,6 +663,8 @@ def show_anns(
|
|
|
613
663
|
Returns:
|
|
614
664
|
Optional[go.Figure]: The figure object if return_fig is True, otherwise None.
|
|
615
665
|
"""
|
|
666
|
+
_check_dependencies("plotly", "pillow")
|
|
667
|
+
|
|
616
668
|
return display_image(
|
|
617
669
|
cocoGt,
|
|
618
670
|
image_id=image_id,
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
import faster_coco_eval.core.mask as mask_util
|
|
4
|
+
|
|
1
5
|
try:
|
|
2
6
|
import cv2
|
|
3
7
|
|
|
4
8
|
opencv_available = True
|
|
5
9
|
except ImportError:
|
|
10
|
+
cv2 = None
|
|
6
11
|
opencv_available = False
|
|
7
12
|
|
|
8
|
-
import numpy as np
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
def _check_opencv():
|
|
15
|
+
"""Check if OpenCV is available and raise informative error."""
|
|
16
|
+
if not opencv_available:
|
|
17
|
+
message = "Missing dependency: opencv-python\n"
|
|
18
|
+
message += "Use: pip install faster-coco-eval[extra]"
|
|
19
|
+
raise ImportError(message)
|
|
11
20
|
|
|
12
21
|
|
|
13
22
|
def conver_mask_to_poly(mask: np.ndarray, bbox: list, boxes_margin: float = 0.1) -> list:
|
|
@@ -21,6 +30,8 @@ def conver_mask_to_poly(mask: np.ndarray, bbox: list, boxes_margin: float = 0.1)
|
|
|
21
30
|
Returns:
|
|
22
31
|
list: List of polygons in COCO format (list of lists of coordinates).
|
|
23
32
|
"""
|
|
33
|
+
_check_opencv()
|
|
34
|
+
|
|
24
35
|
x1, y1, w, h = bbox
|
|
25
36
|
x2 = x1 + w
|
|
26
37
|
y2 = y1 + h
|
|
@@ -89,9 +100,6 @@ def convert_ann_rle_to_poly(ann: dict) -> dict:
|
|
|
89
100
|
Exception: If OpenCV is not available and conversion is required.
|
|
90
101
|
"""
|
|
91
102
|
if type(ann["segmentation"]) is dict:
|
|
92
|
-
if not opencv_available:
|
|
93
|
-
raise Exception("Your dataset needs to be converted to polygons. Install **opencv-python** for this.")
|
|
94
|
-
|
|
95
103
|
ann["counts"] = ann["segmentation"]
|
|
96
104
|
ann["segmentation"] = convert_rle_to_poly(ann["segmentation"], ann["bbox"])
|
|
97
105
|
return ann
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "1.6.
|
|
1
|
+
__version__ = "1.6.8"
|
|
2
2
|
__author__ = "MiXaiLL76"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: faster-coco-eval
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.8
|
|
4
4
|
Summary: Faster interpretation of the original COCOEval
|
|
5
5
|
Home-page: https://github.com/MiXaiLL76/faster_coco_eval
|
|
6
6
|
Author: MiXaiLL76
|
|
@@ -20,20 +20,14 @@ Requires-Python: >=3.7
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: numpy
|
|
23
|
-
Requires-Dist: plotly
|
|
24
|
-
Requires-Dist: pandas
|
|
25
|
-
Requires-Dist: Pillow
|
|
26
23
|
Provides-Extra: extra
|
|
27
24
|
Requires-Dist: numpy; extra == "extra"
|
|
28
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: opencv-python-headless; extra == "extra"
|
|
29
26
|
Requires-Dist: pandas; extra == "extra"
|
|
27
|
+
Requires-Dist: plotly; extra == "extra"
|
|
30
28
|
Requires-Dist: Pillow; extra == "extra"
|
|
31
|
-
Requires-Dist: opencv-python-headless; extra == "extra"
|
|
32
29
|
Provides-Extra: tests
|
|
33
30
|
Requires-Dist: numpy; extra == "tests"
|
|
34
|
-
Requires-Dist: plotly; extra == "tests"
|
|
35
|
-
Requires-Dist: pandas; extra == "tests"
|
|
36
|
-
Requires-Dist: Pillow; extra == "tests"
|
|
37
31
|
Requires-Dist: numpy; extra == "tests"
|
|
38
32
|
Requires-Dist: pycocotools; python_version < "3.13" and extra == "tests"
|
|
39
33
|
Requires-Dist: pytest; extra == "tests"
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
numpy
|
|
2
|
-
plotly
|
|
3
|
-
pandas
|
|
4
|
-
Pillow
|
|
5
2
|
|
|
6
3
|
[extra]
|
|
7
4
|
numpy
|
|
8
|
-
|
|
5
|
+
opencv-python-headless
|
|
9
6
|
pandas
|
|
7
|
+
plotly
|
|
10
8
|
Pillow
|
|
11
|
-
opencv-python-headless
|
|
12
9
|
|
|
13
10
|
[tests]
|
|
14
11
|
numpy
|
|
15
|
-
plotly
|
|
16
|
-
pandas
|
|
17
|
-
Pillow
|
|
18
12
|
pytest
|
|
19
13
|
pytest-cov
|
|
20
14
|
parameterized
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
numpy
|
|
@@ -2,8 +2,12 @@ import os
|
|
|
2
2
|
import unittest
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
import plotly.graph_objs as go
|
|
8
|
+
from PIL import Image
|
|
9
|
+
except ImportError:
|
|
10
|
+
raise unittest.SkipTest("Skipping all tests for faster_coco_eval.extra.draw.")
|
|
7
11
|
|
|
8
12
|
from faster_coco_eval.extra.draw import (
|
|
9
13
|
display_image,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/cocoeval.cpp
RENAMED
|
File without changes
|
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/csrc/faster_eval_api/coco_eval/dataset.cpp
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/__init__.py
RENAMED
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/coco_dataset.py
RENAMED
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval/utils/pytorch/coco_eval.py
RENAMED
|
File without changes
|
|
File without changes
|
{faster_coco_eval-1.6.7 → faster_coco_eval-1.6.8}/faster_coco_eval.egg-info/dependency_links.txt
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|