Mercurial > hg > nsaunier > traffic-intelligence
annotate scripts/extract-appearance-images.py @ 901:753a081989e2
factorized some argument handling code
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 22 Jun 2017 12:02:34 -0400 |
| parents | 85b81c46c526 |
| children | c69a8defe5c3 |
| rev | line source |
|---|---|
| 900 | 1 #! /usr/bin/env python |
| 2 | |
| 3 import numpy as np | |
| 4 import argparse | |
| 5 from cv2 import SVM_RBF, SVM_C_SVC | |
| 6 #from cv2.ml import SVM_RBF, SVM_C_SVC, ROW_SAMPLE # row_sample for layout in cv2.ml.SVM_load | |
| 7 | |
| 8 import cvutils, moving, ml, storage | |
| 9 | |
| 10 parser = argparse.ArgumentParser(description='The program extracts labeled image patches to train the HoG-SVM classifier, and optionnally speed information') | |
|
901
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
11 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
12 |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
13 #parser.add_argument('-d', dest = 'directoryName', help = 'parent directory name for the directories containing the samples for the different road users', required = True) |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
14 |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
15 args = parser.parse_args() |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
16 params = storage.ProcessParameters(args.configFilename) |
|
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
17 classifierParams = storage.ClassifierParameters(params.classifierFilename) |
| 900 | 18 |
| 19 # need all info as for classification (image info) | |
| 20 | |
| 21 # todo speed info: distributions AND min speed equiprobable | |
| 22 | |
| 23 # provide csv delimiter for the classification file as arg | |
|
901
753a081989e2
factorized some argument handling code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
900
diff
changeset
|
24 |
