From d004de946b9512f6141d4bb2d888981534bb3e50 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Fri, 5 Feb 2021 15:26:25 +0100
Subject: [PATCH] Added options to specify dataset path and whether to
 overwrite existing model evaluations.

---
 pysegcnn/core/cli.py  | 15 ++++++++++++++-
 pysegcnn/main/eval.py |  4 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/pysegcnn/core/cli.py b/pysegcnn/core/cli.py
index 021dfe7..da2495f 100644
--- a/pysegcnn/core/cli.py
+++ b/pysegcnn/core/cli.py
@@ -126,7 +126,7 @@ def evaluation_parser():
     # in cross validation
     parser.add_argument('-a', '--aggregate', type=bool,
                         help=('Aggregate the statistics of the different '
-                              'models matching the defined pattern. {}.'
+                              'models matching the defined pattern {}.'
                               .format(default)),
                         default=False, nargs='?', const=True, metavar='')
 
@@ -162,10 +162,23 @@ def evaluation_parser():
                               .format(default)),
                         default=False, nargs='?', const=True, metavar='')
 
+    # optional argument: whether to overwrite existing files
+    parser.add_argument('-o', '--overwrite', type=bool,
+                        help=('Overwrite existing model evaluations {}.'
+                              .format(default)),
+                        default=False, nargs='?', const=True, metavar='')
+
     # optional argument: plot scenes
     parser.add_argument('-plot', '--plot-scenes', type=bool,
                         help=('Save plots for each predicted scene {}.'
                               .format(default)),
                         default=False, nargs='?', const=True, metavar='')
 
+    # optional argument: dataset path
+    parser.add_argument('-ds', '--dataset-path', type=str,
+                        help=('Path to the datasets on the current machine {}.'
+                              'Per default, it is assumed to be same as during'
+                              ' model training .'.format(default)),
+                        default='', metavar='')
+
     return parser
diff --git a/pysegcnn/main/eval.py b/pysegcnn/main/eval.py
index d97deec..1d09aba 100644
--- a/pysegcnn/main/eval.py
+++ b/pysegcnn/main/eval.py
@@ -73,10 +73,12 @@ if __name__ == '__main__':
             aggregate=args.aggregate,
             ds=ds,
             ds_split=ds_split,
+            drive_path=args.dataset_path,
             map_labels=args.map_labels,
             predict_scene=args.predict_scene,
             plot_scenes=args.plot_scenes,
-            cm=args.confusion_matrix)
+            cm=args.confusion_matrix,
+            overwrite=args.overwrite)
 
         # evaluate models
         output = inference.evaluate()
-- 
GitLab