Mercurial Hosting > traffic-intelligence
annotate scripts/classify-objects.py @ 788:5b970a5bc233 dev
updated classifying code to OpenCV 3.x (bug in function to load classification models)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 24 Mar 2016 16:37:37 -0400 |
parents | de278c5e65f6 |
children | 1158a6e2d28e |
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 |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
3 import cvutils, moving, ml, storage |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
4 |
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
|
5 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
|
6 import sys, argparse |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
7 from cv2 import SVM_RBF, SVM_C_SVC |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
8 import cv2 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
9 from scipy.stats import norm, lognorm |
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
|
10 |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
11 # TODO add mode detection live, add choice of kernel and svm type (to be saved in future classifier format) |
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
|
12 |
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
|
13 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
|
14 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
15 parser.add_argument('--kernel', dest = 'kernelType', help = 'kernel type for the support vector machine (SVM)', default = SVM_RBF, type = long) |
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
16 parser.add_argument('--svm', dest = 'svmType', help = 'SVM type', default = SVM_C_SVC, type = long) |
686
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
17 parser.add_argument('-d', dest = 'databaseFilename', help = 'name of the Sqlite database file (overrides the configuration file)') |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
18 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (overrides the configuration file)') |
685
94b291a5f933
several updates for display
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
684
diff
changeset
|
19 parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to classify', type = int, default = None) |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
20 parser.add_argument('--plot-speed-distributions', dest = 'plotSpeedDistribution', help = 'simply plots the distributions used for each user type', action = 'store_true') |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
21 parser.add_argument('--max-speed-distribution-plot', dest = 'maxSpeedDistributionPlot', help = 'if plotting the user distributions, the maximum speed to display', type = float, default = 50.) |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
22 |
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
|
23 args = parser.parse_args() |
536
95276d310972
renamed TrackingParameters to ProcessParameters
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
529
diff
changeset
|
24 params = storage.ProcessParameters(args.configFilename) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
25 |
686
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
26 if args.videoFilename is not None: |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
27 videoFilename = args.videoFilename |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
28 else: |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
29 videoFilename = params.videoFilename |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
30 if args.databaseFilename is not None: |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
31 databaseFilename = args.databaseFilename |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
32 else: |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
33 databaseFilename = params.databaseFilename |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
34 |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
35 params.convertToFrames(3.6) |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
36 if params.homography is not None: |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
37 invHomography = np.linalg.inv(params.homography) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
38 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
39 if params.speedAggregationMethod == 'median': |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
40 speedAggregationFunc = np.median |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
41 elif params.speedAggregationMethod == 'mean': |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
42 speedAggregationFunc = np.mean |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
43 elif params.speedAggregationMethod == 'quantile': |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
44 speedAggregationFunc = lambda speeds: np.percentile(speeds, args.speedAggregationQuantile) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
45 else: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
46 print('Unknown speed aggregation method: {}. Exiting'.format(params.speedAggregationMethod)) |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
47 sys.exit() |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
48 |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
49 pedBikeCarSVM = ml.SVM(args.svmType, args.kernelType) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
50 pedBikeCarSVM.load(params.pedBikeCarSVMFilename) |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
51 bikeCarSVM = ml.SVM(args.svmType, args.kernelType) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
52 bikeCarSVM.load(params.bikeCarSVMFilename) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
53 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
54 # log logistic for ped and bik otherwise ((pedBeta/pedAlfa)*((sMean/pedAlfa)**(pedBeta-1)))/((1+(sMean/pedAlfa)**pedBeta)**2.) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
55 speedProbabilities = {'car': lambda s: norm(params.meanVehicleSpeed, params.stdVehicleSpeed).pdf(s), |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
56 'pedestrian': lambda s: norm(params.meanPedestrianSpeed, params.stdPedestrianSpeed).pdf(s), |
687
de278c5e65f6
minor comments for lognormal parameters (numpy and usual names differ)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
686
diff
changeset
|
57 'bicycle': lambda s: lognorm(params.scaleCyclistSpeed, loc = 0., scale = np.exp(params.locationCyclistSpeed)).pdf(s)} # numpy lognorm shape, loc, scale: shape for numpy is scale (std of the normal) and scale for numpy is location (mean of the normal) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
58 |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
59 if args.plotSpeedDistribution: |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
60 import matplotlib.pyplot as plt |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
61 plt.figure() |
682 | 62 for k in speedProbabilities: |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
63 plt.plot(np.arange(0.1, args.maxSpeedDistributionPlot, 0.1), [speedProbabilities[k](s/3.6/25) for s in np.arange(0.1, args.maxSpeedDistributionPlot, 0.1)], label = k) |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
64 plt.xlabel('Speed (km/h)') |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
65 plt.ylabel('Probability') |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
66 plt.legend() |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
67 plt.title('Probability Density Function') |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
68 plt.show() |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
69 sys.exit() |
682 | 70 |
686
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
71 objects = storage.loadTrajectoriesFromSqlite(databaseFilename, 'object', args.nObjects, withFeatures = True) |
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
72 #features = storage.loadTrajectoriesFromSqlite(databaseFilename, 'feature') |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
73 intervals = [] |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
74 for obj in objects: |
685
94b291a5f933
several updates for display
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
684
diff
changeset
|
75 #obj.setFeatures(features) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
76 intervals.append(obj.getTimeInterval()) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
77 timeInterval = moving.unionIntervals(intervals) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
78 |
686
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
79 capture = cv2.VideoCapture(videoFilename) |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
80 width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) |
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
81 height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
82 |
684
6d2ece4aed7c
bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
683
diff
changeset
|
83 pastObjects = [] |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
84 if params.undistort: # setup undistortion |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
85 [map1, map2] = computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
86 if capture.isOpened(): |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
87 ret = True |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
88 frameNum = timeInterval.first |
788
5b970a5bc233
updated classifying code to OpenCV 3.x (bug in function to load classification models)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
687
diff
changeset
|
89 capture.set(cv2.CAP_PROP_POS_FRAMES, frameNum) |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
90 lastFrameNum = timeInterval.last |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
91 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
92 while ret and frameNum <= lastFrameNum: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
93 ret, img = capture.read() |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
94 if ret: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
95 if frameNum%50 == 0: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
96 print('frame number: {}'.format(frameNum)) |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
97 currentObjects = [] |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
98 for obj in objects: |
684
6d2ece4aed7c
bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
683
diff
changeset
|
99 if obj.getLastInstant() < frameNum: |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
100 obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = params.minSpeedEquiprobable, speedProbabilities = speedProbabilities) |
684
6d2ece4aed7c
bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
683
diff
changeset
|
101 pastObjects.append(obj) |
683
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
102 else: |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
103 currentObjects.append(obj) |
f3a0b652b590
added function to display the speed distributions and optimize a little going through objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
682
diff
changeset
|
104 objects = currentObjects |
680
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
105 if params.undistort: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
106 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
107 for obj in objects: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
108 if obj.existsAtInstant(frameNum): |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
109 if obj.getFirstInstant() == frameNum: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
110 obj.initClassifyUserTypeHoGSVM(speedAggregationFunc, pedBikeCarSVM, bikeCarSVM, params.maxPedestrianSpeed, params.maxCyclistSpeed, params.nFramesIgnoreAtEnds) |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
111 obj.classifyUserTypeHoGSVMAtInstant(img, frameNum, invHomography, width, height, 0.2, 0.2, 800) # px, py, pixelThreshold |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
112 frameNum += 1 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
113 |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
114 for obj in objects: |
da1352b89d02
classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
536
diff
changeset
|
115 obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = params.minSpeedEquiprobable, speedProbabilities = speedProbabilities) |
684
6d2ece4aed7c
bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
683
diff
changeset
|
116 pastObjects.append(obj) |
6d2ece4aed7c
bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
683
diff
changeset
|
117 print('Saving user types') |
686
cdee6a3a47b4
allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
685
diff
changeset
|
118 storage.setRoadUserTypes(databaseFilename, pastObjects) |