diff scripts/nomad/site-parameters-optimization.py @ 1223:051cf5bddc1f

work on optimization (improved for feature tracking)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 21 Jun 2023 23:57:54 -0400
parents 5a207c838323
children a09a80cdc118
line wrap: on
line diff
--- a/scripts/nomad/site-parameters-optimization.py	Tue Jun 20 15:42:19 2023 -0400
+++ b/scripts/nomad/site-parameters-optimization.py	Wed Jun 21 23:57:54 2023 -0400
@@ -19,21 +19,24 @@
     
 def paraValueList(x):
     #create para-value list
-    #list of the 8 parameters and their values
-    p = 8*[None]
-    p[0] = '--feature-quality'             #]0.-0.4]
-    p[1] = '--min-feature-distanceklt'     #]0.-6]
-    p[2] = '--window-size'                 #[1-10]integer
-    p[3] = '--min-tracking-error'          #[0.01-0.3]
-    p[4] = '--min-feature-time'            #[2-100]integer
-    p[5] = '--mm-connection-distance'      #[0.5-100]
-    p[6] = '--mm-segmentation-distance'    #[1-100] ~mm-connection-distance / 2.5
-    p[7] = '--min-nfeatures-group'         #[2-4]
+    #list of the parameters and their values
+    p = ['--feature-quality',             #]0.-0.4]
+         '--min-feature-distanceklt',     #]0.-10]
+         '--block-size',                  #[1-10]integer
+         '--window-size',                 #[1-10]integer
+         '--min-feature-displacement',    #[0.0001-0.1] 0.05
+         '--acceleration-bound',          #[1.-5.] 3
+         '--deviation-bound',             #[-1, 1] 0.6
+         #p[3] = '--min-tracking-error'          #[0.01-0.3]
+         '--min-feature-time',            #[2-100]integer
+         '--mm-connection-distance',      #[0.5-100]
+         '--mm-segmentation-distance',    #[1-100] ~mm-connection-distance / 2.5
+         '--min-nfeatures-group']         #[2-4]
     
     para = []
     if len(x) == 4:
         for n in range(4):
-            para = para + [p[4+n],x[n]]
+            para = para + [p[-4+n],x[n]]
     else:
         for n in range(len(x)):
             para = para + [p[n],x[n]]
@@ -112,11 +115,15 @@
     #     optimizeGroupingOnly = eval(args[1])
     #     intersections = eval(intersections)
     
-    # Just write the intersections to optimize here
-    intersections = ['.']#['/home/nicolas/Research/Data/montreal/12-07-laurier']
+    # Just write the intersections to optimize here: do not use '~' for home directory
+    intersections = ['/home/nicolas/Research/Data3/test-optimization/12-laurier']
     recursive = False
 
-    para = loadParameters(sys.argv[1])
-    # run process including trackingfeature, groupfeature, load groundtruth, compute mota
-    print(process(para, intersections, recursive))
+    # first and only argument should be the
+    if len(sys.argv) == 2:
+        para = loadParameters(sys.argv[1])
+        # run process including trackingfeature, groupfeature, load groundtruth, compute mota
+        print(process(para, intersections, recursive))
+    else:
+        print('Usage: site-parameters-optimization.py [initial-parameters text file]')
     sys.exit(0)