EasyMetrics 0.1.0__py3-none-any.whl → 0.1.5__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.
- easyMetrics/tasks/detection/format_converter.py +22 -2
- {easymetrics-0.1.0.dist-info → easymetrics-0.1.5.dist-info}/METADATA +1 -1
- {easymetrics-0.1.0.dist-info → easymetrics-0.1.5.dist-info}/RECORD +6 -6
- {easymetrics-0.1.0.dist-info → easymetrics-0.1.5.dist-info}/WHEEL +0 -0
- {easymetrics-0.1.0.dist-info → easymetrics-0.1.5.dist-info}/licenses/LICENSE +0 -0
- {easymetrics-0.1.0.dist-info → easymetrics-0.1.5.dist-info}/top_level.txt +0 -0
|
@@ -84,8 +84,18 @@ class DetectionFormatConverter:
|
|
|
84
84
|
def _convert_coco_preds(coco_preds: List[Any]) -> List[Dict[str, Any]]:
|
|
85
85
|
"""
|
|
86
86
|
转换 COCO 格式的预测结果。
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
支持两种格式:
|
|
89
|
+
1. COCO 官方格式: [{"image_id": 0, "category_id": 0, "bbox": [0, 0, 100, 100], "score": 0.9}]
|
|
90
|
+
2. 内部统一格式: [{"boxes": [[x1, y1, x2, y2]], "scores": [0.9], "labels": [0]}]
|
|
88
91
|
"""
|
|
92
|
+
# 检查是否已经是内部统一格式
|
|
93
|
+
if coco_preds and isinstance(coco_preds[0], dict):
|
|
94
|
+
first_pred = coco_preds[0]
|
|
95
|
+
if 'boxes' in first_pred and 'scores' in first_pred and 'labels' in first_pred:
|
|
96
|
+
# 已经是内部统一格式,直接返回
|
|
97
|
+
return coco_preds
|
|
98
|
+
|
|
89
99
|
# 按 image_id 分组
|
|
90
100
|
grouped_preds = {}
|
|
91
101
|
for pred in coco_preds:
|
|
@@ -111,8 +121,18 @@ class DetectionFormatConverter:
|
|
|
111
121
|
def _convert_coco_targets(coco_targets: List[Any]) -> List[Dict[str, Any]]:
|
|
112
122
|
"""
|
|
113
123
|
转换 COCO 格式的真实标签。
|
|
114
|
-
|
|
124
|
+
|
|
125
|
+
支持两种格式:
|
|
126
|
+
1. COCO 官方格式: [{"image_id": 0, "category_id": 0, "bbox": [0, 0, 100, 100], "area": 10000, "iscrowd": 0}]
|
|
127
|
+
2. 内部统一格式: [{"boxes": [[x1, y1, x2, y2]], "labels": [0]}]
|
|
115
128
|
"""
|
|
129
|
+
# 检查是否已经是内部统一格式
|
|
130
|
+
if coco_targets and isinstance(coco_targets[0], dict):
|
|
131
|
+
first_target = coco_targets[0]
|
|
132
|
+
if 'boxes' in first_target and 'labels' in first_target:
|
|
133
|
+
# 已经是内部统一格式,直接返回
|
|
134
|
+
return coco_targets
|
|
135
|
+
|
|
116
136
|
# 按 image_id 分组
|
|
117
137
|
grouped_targets = {}
|
|
118
138
|
for target in coco_targets:
|
|
@@ -3,13 +3,13 @@ easyMetrics/core/__init__.py,sha256=L-JsvnYEbmJZPzf8oBbldRA-B6Oni3AtJaZZJEuDOwA,
|
|
|
3
3
|
easyMetrics/core/base.py,sha256=pMRZCl_SJtfCo-_fzuGijkYMSq1DDIZegI96EWxUX6k,789
|
|
4
4
|
easyMetrics/tasks/__init__.py,sha256=Cwc3WM7ZgblWq1jfIjrHt_bBrJRobx4q_WbHn3LaN68,44
|
|
5
5
|
easyMetrics/tasks/detection/__init__.py,sha256=74SsA-fJbamX7WGIWJJmeTXjjHnogYU1jwYse65d45U,80
|
|
6
|
-
easyMetrics/tasks/detection/format_converter.py,sha256=
|
|
6
|
+
easyMetrics/tasks/detection/format_converter.py,sha256=80vM8B3exuH6EHlmYwvMrpslTDm-FMWzuccQKka42dc,12632
|
|
7
7
|
easyMetrics/tasks/detection/interface.py,sha256=ZbR9aJVXsRiSNGrhcVZAEGkfH2SFX0kJi0XY_rUEbMA,2568
|
|
8
8
|
easyMetrics/tasks/detection/map.py,sha256=F2qVDTQR1qr1SHEf3w3Xg7yvUytzfQtxXdF6p25CcwA,17471
|
|
9
9
|
easyMetrics/tasks/detection/matcher.py,sha256=C-4hEVBJseQKgcHupBLlaDNFGhKxOxN-YdPNnpuit9I,2443
|
|
10
10
|
easyMetrics/tasks/detection/utils.py,sha256=jNDPHxWzGo7478QDI1f8uVGK6HUlwvHlPbfwzEk-H0A,2770
|
|
11
|
-
easymetrics-0.1.
|
|
12
|
-
easymetrics-0.1.
|
|
13
|
-
easymetrics-0.1.
|
|
14
|
-
easymetrics-0.1.
|
|
15
|
-
easymetrics-0.1.
|
|
11
|
+
easymetrics-0.1.5.dist-info/licenses/LICENSE,sha256=Z-thSEoGCfxHrpC8rpgrqY-LSoJuyHbgPj5Gt8BuG_0,1073
|
|
12
|
+
easymetrics-0.1.5.dist-info/METADATA,sha256=2iaYmKt03dFhBsxudv6nFfiOLrmQ23Vsqm9mIwaCqMs,5265
|
|
13
|
+
easymetrics-0.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
14
|
+
easymetrics-0.1.5.dist-info/top_level.txt,sha256=2ytZxZ9LMTdKpeZunCE1rpvkpDAhWeQLiiXTrFy9niw,12
|
|
15
|
+
easymetrics-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|