annotate scripts/classify-objects.py @ 807:52aa03260f03 opencv3

reversed all code to OpenCV 2.4.13
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 10 Jun 2016 15:26:19 -0400
parents 8eb8a6bd70e8
children 21f10332c72b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
807
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
7 #from cv2.ml 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)
807
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
15 parser.add_argument('--kernel', dest = 'kernelType', help = 'kernel type for the support vector machine (SVM)', default = cv2.SVM_RBF, type = long)
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
16 parser.add_argument('--svm', dest = 'svmType', help = 'SVM type', default = cv2.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)
791
1158a6e2d28e temporary solution for classification, with corrected svm.cpp and ml.hpp for loading saved classifiers
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 788
diff changeset
38 else:
1158a6e2d28e temporary solution for classification, with corrected svm.cpp and ml.hpp for loading saved classifiers
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 788
diff changeset
39 invHomography = None
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
40
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
41 if params.speedAggregationMethod == 'median':
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
42 speedAggregationFunc = np.median
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
43 elif params.speedAggregationMethod == 'mean':
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
44 speedAggregationFunc = np.mean
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
45 elif params.speedAggregationMethod == 'quantile':
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
46 speedAggregationFunc = lambda speeds: np.percentile(speeds, args.speedAggregationQuantile)
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
47 else:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
48 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
49 sys.exit()
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
50
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 pedBikeCarSVM = ml.SVM(args.svmType, args.kernelType)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
52 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
53 bikeCarSVM = ml.SVM(args.svmType, args.kernelType)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
54 bikeCarSVM.load(params.bikeCarSVMFilename)
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
55
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
56 # 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
57 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
58 '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
59 '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
60
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
61 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
62 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
63 plt.figure()
682
fbe29be25501 corrected bug
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 680
diff changeset
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 sys.exit()
682
fbe29be25501 corrected bug
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 680
diff changeset
72
686
cdee6a3a47b4 allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 685
diff changeset
73 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
74 #features = storage.loadTrajectoriesFromSqlite(databaseFilename, 'feature')
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
75 intervals = []
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
76 for obj in objects:
685
94b291a5f933 several updates for display
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 684
diff changeset
77 #obj.setFeatures(features)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
78 intervals.append(obj.getTimeInterval())
791
1158a6e2d28e temporary solution for classification, with corrected svm.cpp and ml.hpp for loading saved classifiers
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 788
diff changeset
79 timeInterval = moving.TimeInterval.unionIntervals(intervals)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
80
686
cdee6a3a47b4 allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 685
diff changeset
81 capture = cv2.VideoCapture(videoFilename)
807
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
82 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH))
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
83 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT))
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
84
684
6d2ece4aed7c bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 683
diff changeset
85 pastObjects = []
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
86 if params.undistort: # setup undistortion
794
8eb8a6bd70e8 corrected more bug in script
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 793
diff changeset
87 [map1, map2] = cvutils.computeUndistortMaps(width, height, params.undistortedImageMultiplication, params.intrinsicCameraMatrix, params.distortionCoefficients)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
88 if capture.isOpened():
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
89 ret = True
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
90 frameNum = timeInterval.first
807
52aa03260f03 reversed all code to OpenCV 2.4.13
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 794
diff changeset
91 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, frameNum)
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
92 lastFrameNum = timeInterval.last
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
93
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
94 while ret and frameNum <= lastFrameNum:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
95 ret, img = capture.read()
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
96 if ret:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
97 if frameNum%50 == 0:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
98 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
99 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
100 for obj in objects:
684
6d2ece4aed7c bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 683
diff changeset
101 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
102 obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = params.minSpeedEquiprobable, speedProbabilities = speedProbabilities)
684
6d2ece4aed7c bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 683
diff changeset
103 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
104 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
105 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
106 objects = currentObjects
680
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
107 if params.undistort:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
108 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR)
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
109 for obj in objects:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
110 if obj.existsAtInstant(frameNum):
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
111 if obj.getFirstInstant() == frameNum:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
112 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
113 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
114 frameNum += 1
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
115
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
116 for obj in objects:
da1352b89d02 classification is working
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 536
diff changeset
117 obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = params.minSpeedEquiprobable, speedProbabilities = speedProbabilities)
684
6d2ece4aed7c bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 683
diff changeset
118 pastObjects.append(obj)
6d2ece4aed7c bug forgot to svae objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 683
diff changeset
119 print('Saving user types')
686
cdee6a3a47b4 allowing alternate database and filename for classify-objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents: 685
diff changeset
120 storage.setRoadUserTypes(databaseFilename, pastObjects)