changeset 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 69b531c7a061
children a09a80cdc118
files c/feature-based-tracking.cpp scripts/nomad/initial-parameters.txt scripts/nomad/nomad-parameters.txt scripts/nomad/site-parameters-optimization.py
diffstat 4 files changed, 28 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp	Tue Jun 20 15:42:19 2023 -0400
+++ b/c/feature-based-tracking.cpp	Wed Jun 21 23:57:54 2023 -0400
@@ -98,7 +98,7 @@
 
   VideoCapture capture(::getRelativeFilename(params.parentDirname, params.videoFilename));
   if(!capture.isOpened()) {
-    cout << "Video filename " << params.videoFilename << " could not be opened. Exiting." << endl;
+    cout << "Video filename " << params.videoFilename << " could not be opened (check filename first). Exiting." << endl;
     exit(0);
   }
   
--- a/scripts/nomad/initial-parameters.txt	Tue Jun 20 15:42:19 2023 -0400
+++ b/scripts/nomad/initial-parameters.txt	Wed Jun 21 23:57:54 2023 -0400
@@ -1,1 +1,1 @@
-0.1 3.54964337411 6 0.1833289751 15 2.5 0.5 3
+0.1 3.54964337411 7 6 0.05 3 0.6 15 2.5 0.5 3
--- a/scripts/nomad/nomad-parameters.txt	Tue Jun 20 15:42:19 2023 -0400
+++ b/scripts/nomad/nomad-parameters.txt	Wed Jun 21 23:57:54 2023 -0400
@@ -1,12 +1,12 @@
-DIMENSION	8						# number of variables
+DIMENSION	11						# number of variables
 
 BB_EXE		"$python3 site-parameters-optimization.py"      # 'site-parameters-optimization.py' is the blackbox program
 BB_OUTPUT_TYPE	OBJ					        # object will be minimized
 
 X0		initial-parameters.txt                          # starting point
 
-LOWER_BOUND	( 0 0  1  0.01 2 0.1 0.1 1.0)			# all variables' lower bounds
-UPPER_BOUND	( 1 10 10 0.3  100 10 5 15 )			# all variables' upper bounds
+LOWER_BOUND	( 0.01 0 1 1 0.0001 1 -1 2 0.1 0.1 1.0)			# all variables' lower bounds
+UPPER_BOUND	( 1 10 10 10 0.1 5 1 100 10 5 15 )			# all variables' upper bounds
 
 MAX_BB_EVAL	500						# the algorithm terminates when
 								# n black-box evaluations have
--- 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)