Spaces:
Sleeping
Sleeping
franzi2505
commited on
Commit
•
2b772af
1
Parent(s):
d603ef5
improve return structure
Browse files- PanopticQuality.py +11 -7
PanopticQuality.py
CHANGED
@@ -177,16 +177,20 @@ class PQMetric(evaluate.Metric):
|
|
177 |
# compute scores
|
178 |
result = self.pq_metric.compute() # shape : (n_classes (sorted things + sorted stuffs), scores (pq, sq, rq))
|
179 |
|
180 |
-
result_dict =
|
181 |
-
"numbers": {id2label[numeric_label]: [tp[i].item(), fp[i].item(), fn[i].item(), iou[i].item()] \
|
182 |
-
for i, numeric_label in enumerate(things_stuffs)},
|
183 |
-
"scores": None
|
184 |
-
}
|
185 |
|
186 |
if self.per_class:
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
else:
|
189 |
-
result_dict["scores"] = result.tolist()
|
|
|
190 |
|
191 |
return result_dict
|
192 |
|
|
|
177 |
# compute scores
|
178 |
result = self.pq_metric.compute() # shape : (n_classes (sorted things + sorted stuffs), scores (pq, sq, rq))
|
179 |
|
180 |
+
result_dict = dict()
|
|
|
|
|
|
|
|
|
181 |
|
182 |
if self.per_class:
|
183 |
+
if not self.split_sq_rq:
|
184 |
+
result = result.T
|
185 |
+
result_dict["scores"] = {id2label[numeric_label]: result[i].tolist() \
|
186 |
+
for i, numeric_label in enumerate(things_stuffs)}
|
187 |
+
result_dict["scores"].update({"overall": result.mean(axis=0).tolist()})
|
188 |
+
result_dict["numbers"] = {id2label[numeric_label]: [tp[i].item(), fp[i].item(), fn[i].item(), iou[i].item()] \
|
189 |
+
for i, numeric_label in enumerate(things_stuffs)}
|
190 |
+
result_dict["numbers"].update({"overall": [tp.sum().item(), fp.sum().item(), fn.sum().item(), iou.sum().item()]})
|
191 |
else:
|
192 |
+
result_dict["scores"] = result.tolist() if self.split_sq_rq else [result.tolist()]
|
193 |
+
result_dict["numbers"] = [tp.sum().item(), fp.sum().item(), fn.sum().item(), iou.sum().item()]
|
194 |
|
195 |
return result_dict
|
196 |
|