Spaces:
Sleeping
Sleeping
franzi2505
commited on
Commit
•
09d1031
1
Parent(s):
5ec0a16
fix bug where own_boat and construction classes are confused in results
Browse files- PanopticQuality.py +3 -3
PanopticQuality.py
CHANGED
@@ -124,7 +124,7 @@ class PQMetric(evaluate.Metric):
|
|
124 |
return_sq_and_rq=split_sq_rq,
|
125 |
areas=area_rng
|
126 |
)
|
127 |
-
self.
|
128 |
|
129 |
def _info(self):
|
130 |
return evaluate.MetricInfo(
|
@@ -187,10 +187,10 @@ class PQMetric(evaluate.Metric):
|
|
187 |
if not self.split_sq_rq:
|
188 |
result = result.unsqueeze(0)
|
189 |
result_dict["scores"] = {self.id2label[numeric_label]: result[:,:, i].numpy() \
|
190 |
-
for i, numeric_label in
|
191 |
result_dict["scores"].update({"ALL": result.mean(dim=-1).numpy()})
|
192 |
result_dict["numbers"] = {self.id2label[numeric_label]: np.stack([tp[:, i].numpy(), fp[:, i].numpy(), fn[:, i].numpy(), iou[:, i].numpy()])\
|
193 |
-
for i, numeric_label in
|
194 |
result_dict["numbers"].update({"ALL": np.stack([tp.sum(dim=1).numpy(), fp.sum(dim=1).numpy(), fn.sum(dim=1).numpy(), iou.sum(dim=1).numpy()])})
|
195 |
else:
|
196 |
result_dict["scores"] = {"ALL": result.numpy() if self.split_sq_rq else (result.numpy()[np.newaxis, ...] if len(self.pq_metric.get_areas())>1 else result.numpy()[np.newaxis, np.newaxis, ...])}
|
|
|
124 |
return_sq_and_rq=split_sq_rq,
|
125 |
areas=area_rng
|
126 |
)
|
127 |
+
self.cont_to_cat = {label:key for key, label in self.pq_metric.metric.cat_id_to_continuous_id.items()}
|
128 |
|
129 |
def _info(self):
|
130 |
return evaluate.MetricInfo(
|
|
|
187 |
if not self.split_sq_rq:
|
188 |
result = result.unsqueeze(0)
|
189 |
result_dict["scores"] = {self.id2label[numeric_label]: result[:,:, i].numpy() \
|
190 |
+
for i, numeric_label in self.cont_to_cat.items()}
|
191 |
result_dict["scores"].update({"ALL": result.mean(dim=-1).numpy()})
|
192 |
result_dict["numbers"] = {self.id2label[numeric_label]: np.stack([tp[:, i].numpy(), fp[:, i].numpy(), fn[:, i].numpy(), iou[:, i].numpy()])\
|
193 |
+
for i, numeric_label in self.cont_to_cat.items()}
|
194 |
result_dict["numbers"].update({"ALL": np.stack([tp.sum(dim=1).numpy(), fp.sum(dim=1).numpy(), fn.sum(dim=1).numpy(), iou.sum(dim=1).numpy()])})
|
195 |
else:
|
196 |
result_dict["scores"] = {"ALL": result.numpy() if self.split_sq_rq else (result.numpy()[np.newaxis, ...] if len(self.pq_metric.get_areas())>1 else result.numpy()[np.newaxis, np.newaxis, ...])}
|