From 1f8ee6670f0efd44cc3b894fce5270ccae9b0994 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Tue, 16 Feb 2021 15:15:47 +0100
Subject: [PATCH] Avoid namespace confusion.

---
 pysegcnn/core/trainer.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pysegcnn/core/trainer.py b/pysegcnn/core/trainer.py
index 44b6892..5161858 100644
--- a/pysegcnn/core/trainer.py
+++ b/pysegcnn/core/trainer.py
@@ -2733,7 +2733,8 @@ class NetworkInference(BaseConfig):
             df = pd.DataFrame(dtype=float)
             for name, output in inference.items():
                 # classification report DataFrame for all individual models
-                df = pd.concat([df, output['report']], axis=0)
+                report = output['report']
+                df = pd.concat([df, report], axis=0)
 
             # compute k-fold average estimate of each metric across all models
             LOGGER.info('Calculating k-fold estimate of metrics ...')
@@ -2755,8 +2756,8 @@ class NetworkInference(BaseConfig):
                 cm_agg = np.zeros(shape=2 * (len(labels), ))
 
                 # update aggregated confusion matrix
-                for _, metrics in inference.items():
-                    cm_agg += metrics['cm']
+                for name, output in inference.items():
+                    cm_agg += output['cm']
 
                 # save aggregated confusion matrix to dictionary
                 inference['cm'] = cm_agg
-- 
GitLab