Mercurial Hosting > traffic-intelligence
annotate scripts/classify-objects.py @ 651:335f6641bf7a
changed the paramter usePrototypes to False by default
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 17 Apr 2015 17:33:32 +0200 |
parents | 95276d310972 |
children | da1352b89d02 |
rev | line source |
---|---|
522
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
2 |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 import numpy as np |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 import sys, argparse |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 from cv2 import SVM_RBF, SVM_C_SVC |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
6 |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
7 import cvutils, moving, ml |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
8 |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
9 parser = argparse.ArgumentParser(description='The program processes indicators for all pairs of road users in the scene') |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
10 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) |
522
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
11 parser.add_argument('-d', dest = 'directoryName', help = 'name of the parent directory containing the videos and extracted trajectories to process', required = True) |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
12 # parser.add_argument('-o', dest = 'homographyFilename', help = 'name of the image to world homography file') |
529
f527159815ab
work on script
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
522
diff
changeset
|
13 # need a classification config file for speed distribution parameters, svm models, frequency parameters, area parameters etc |
f527159815ab
work on script
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
522
diff
changeset
|
14 #parser.add_argument('--cfg', dest = 'svmType', help = 'SVM type', default = SVM_C_SVC, type = long) |
f527159815ab
work on script
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
522
diff
changeset
|
15 |
f527159815ab
work on script
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
522
diff
changeset
|
16 |
522
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 #parser.add_argument('-s', dest = 'rescaleSize', help = 'rescale size of image samples', default = 64, type = int) |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
18 #parser.add_argument('-o', dest = 'nOrientations', help = 'number of orientations in HoG', default = 9, type = int) |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 #parser.add_argument('-p', dest = 'nPixelsPerCell', help = 'number of pixels per cell', default = 8, type = int) |
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
20 #parser.add_argument('-c', dest = 'nCellsPerBlock', help = 'number of cells per block', default = 2, type = int) |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
21 |
522
ce40a89bd6ae
added functions for classification refactored from Sohail s work for TRB/TRC (to be tested)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
22 args = parser.parse_args() |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
23 params = storage.ProcessParameters(args.configFilename) |