Pārlūkot izejas kodu

update run estimator script

Jérôme BUISINE 4 gadi atpakaļ
vecāks
revīzija
90f55aab83
1 mainītis faili ar 16 papildinājumiem un 15 dzēšanām
  1. 16 15
      run/run_all_estimators.py

+ 16 - 15
run/run_all_estimators.py

@@ -8,6 +8,7 @@ def main():
     parser = argparse.ArgumentParser("Run estimators reconstruction")
     parser.add_argument('--folder', type=str, help='folder with rawls scene data', required=True)
     parser.add_argument('--nfiles', type=int, help='expected number of rawls files', required=True)
+    parser.add_argument('--est', type=str, help='estimator to use', choices=estimators, required=True)
     parser.add_argument('--tiles', type=str, help='tiles size: 100,100', default="100,100")
     parser.add_argument('--output', type=str, help='output folder', required=True)
 
@@ -15,30 +16,30 @@ def main():
 
     p_folder = args.folder
     p_nfiles = args.nfiles
-    x_tile, y_tile   = list(map(int, args.tiles.split(',')))
+    p_est = args.estimators
+    x_tile, y_tile = list(map(int, args.tiles.split(',')))
     p_output = args.output
 
     scenes = sorted(os.listdir(p_folder))
 
-    for est in estimators:
-        for scene in scenes:
-            scene_path = os.path.join(p_folder, scene)
-            nelements = len(os.listdir(scene_path))
+    for scene in scenes:
+        scene_path = os.path.join(p_folder, scene)
+        nelements = len(os.listdir(scene_path))
 
-            if nelements == p_nfiles:
-                print('Extraction of {0} estimator for {1} scene'.format(est, scene))
+        if nelements == p_nfiles:
+            print('Extraction of {0} estimator for {1} scene'.format(p_est, scene))
 
-                output_folder = os.path.join(p_output, est, scene)
+            output_folder = os.path.join(p_output, p_est, scene)
 
-                if not os.path.exists(output_folder):
-                    os.makedirs(output_folder)
+            if not os.path.exists(output_folder):
+                os.makedirs(output_folder)
 
-                outfilename = os.path.join(output_folder, scene + '_10000.rawls')
+            outfilename = os.path.join(output_folder, scene + '_10000.rawls')
 
-                if not os.path.exists(outfilename):
-                    os.system('./build/main/extract_stats_images --folder {0} --bwidth {1} --bheight {2} --outfile {3} --estimator {4}'.format(scene_path, x_tile, y_tile, est, outfilename))
-                else:
-                    print('Already generated')
+            if not os.path.exists(outfilename):
+                os.system('./build/main/extract_stats_images --folder {0} --bwidth {1} --bheight {2} --outfile {3} --estimator {4}'.format(scene_path, x_tile, y_tile, p_est, outfilename))
+            else:
+                print('Already generated')