Mercurial > hg > nsaunier > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1222:69b531c7a061 | 1223:051cf5bddc1f |
|---|---|
| 17 # create para-value list | 17 # create para-value list |
| 18 return paraValueList(x) | 18 return paraValueList(x) |
| 19 | 19 |
| 20 def paraValueList(x): | 20 def paraValueList(x): |
| 21 #create para-value list | 21 #create para-value list |
| 22 #list of the 8 parameters and their values | 22 #list of the parameters and their values |
| 23 p = 8*[None] | 23 p = ['--feature-quality', #]0.-0.4] |
| 24 p[0] = '--feature-quality' #]0.-0.4] | 24 '--min-feature-distanceklt', #]0.-10] |
| 25 p[1] = '--min-feature-distanceklt' #]0.-6] | 25 '--block-size', #[1-10]integer |
| 26 p[2] = '--window-size' #[1-10]integer | 26 '--window-size', #[1-10]integer |
| 27 p[3] = '--min-tracking-error' #[0.01-0.3] | 27 '--min-feature-displacement', #[0.0001-0.1] 0.05 |
| 28 p[4] = '--min-feature-time' #[2-100]integer | 28 '--acceleration-bound', #[1.-5.] 3 |
| 29 p[5] = '--mm-connection-distance' #[0.5-100] | 29 '--deviation-bound', #[-1, 1] 0.6 |
| 30 p[6] = '--mm-segmentation-distance' #[1-100] ~mm-connection-distance / 2.5 | 30 #p[3] = '--min-tracking-error' #[0.01-0.3] |
| 31 p[7] = '--min-nfeatures-group' #[2-4] | 31 '--min-feature-time', #[2-100]integer |
| 32 '--mm-connection-distance', #[0.5-100] | |
| 33 '--mm-segmentation-distance', #[1-100] ~mm-connection-distance / 2.5 | |
| 34 '--min-nfeatures-group'] #[2-4] | |
| 32 | 35 |
| 33 para = [] | 36 para = [] |
| 34 if len(x) == 4: | 37 if len(x) == 4: |
| 35 for n in range(4): | 38 for n in range(4): |
| 36 para = para + [p[4+n],x[n]] | 39 para = para + [p[-4+n],x[n]] |
| 37 else: | 40 else: |
| 38 for n in range(len(x)): | 41 for n in range(len(x)): |
| 39 para = para + [p[n],x[n]] | 42 para = para + [p[n],x[n]] |
| 40 | 43 |
| 41 return para | 44 return para |
| 110 # args = f.read().split('\n') | 113 # args = f.read().split('\n') |
| 111 # intersections = args[0] | 114 # intersections = args[0] |
| 112 # optimizeGroupingOnly = eval(args[1]) | 115 # optimizeGroupingOnly = eval(args[1]) |
| 113 # intersections = eval(intersections) | 116 # intersections = eval(intersections) |
| 114 | 117 |
| 115 # Just write the intersections to optimize here | 118 # Just write the intersections to optimize here: do not use '~' for home directory |
| 116 intersections = ['.']#['/home/nicolas/Research/Data/montreal/12-07-laurier'] | 119 intersections = ['/home/nicolas/Research/Data3/test-optimization/12-laurier'] |
| 117 recursive = False | 120 recursive = False |
| 118 | 121 |
| 119 para = loadParameters(sys.argv[1]) | 122 # first and only argument should be the |
| 120 # run process including trackingfeature, groupfeature, load groundtruth, compute mota | 123 if len(sys.argv) == 2: |
| 121 print(process(para, intersections, recursive)) | 124 para = loadParameters(sys.argv[1]) |
| 125 # run process including trackingfeature, groupfeature, load groundtruth, compute mota | |
| 126 print(process(para, intersections, recursive)) | |
| 127 else: | |
| 128 print('Usage: site-parameters-optimization.py [initial-parameters text file]') | |
| 122 sys.exit(0) | 129 sys.exit(0) |
