Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 524:1dced8932b08
corrected bugs
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 19 Jun 2014 13:31:00 -0400 |
parents | ce4eaabacc26 |
children | 21bdeb29f855 |
line wrap: on
line diff
--- a/python/moving.py Wed Jun 18 23:40:47 2014 -0400 +++ b/python/moving.py Thu Jun 19 13:31:00 2014 -0400 @@ -821,7 +821,7 @@ ### # User Type Classification ### - def classifyUserTypeSpeedPedstrianCar(self, threshold, aggregationFunc = median, ignoreNInstantsAtEnds = 0): + def classifyUserTypeSpeedMotorized(self, threshold, aggregationFunc = median, ignoreNInstantsAtEnds = 0): '''Classifies slow and fast road users slow: non-motorized -> pedestrians fast: motorized -> cars''' @@ -834,7 +834,7 @@ else: self.setUserType(userType2Num['pedestrian']) - def classifyUserTypeSpeed(self, aggregationFunc = median, speedProbabilities): + def classifyUserTypeSpeed(self, speedProbabilities, aggregationFunc = median): '''Classifies road user per road user type speedProbabilities are functions return P(speed|class) in a dictionary indexed by user type names @@ -876,7 +876,7 @@ else: self.userTypes[instant] = userType2Num['unknown'] - def classifyUserTypeHoGSVM(self, images, pedBikeCarSVM, homography, width, height, bikeCarSVM = None, pedBikeSpeedTreshold = float('Inf'), bikeCarSpeedThreshold = float('Inf'), aggregationFunc = median, speedProbabilities = None, px = 0.2, py = 0.2, pixelThreshold = 800): + def classifyUserTypeHoGSVM(self, images, pedBikeCarSVM, homography, width, height, bikeCarSVM = None, pedBikeSpeedTreshold = float('Inf'), bikeCarSpeedThreshold = float('Inf'), speedProbabilities = None, aggregationFunc = median, px = 0.2, py = 0.2, pixelThreshold = 800): '''Agregates SVM detections in each image and returns probability (proportion of instants with classification in each category) @@ -892,7 +892,7 @@ if t not in self.userTypes: self.classifyUserTypeHoGSVMAtInstant(images[t], pedBikeCarSVM, t, homography, width, height, bikeCarSVM, pedBikeSpeedTreshold, bikeCarSpeedThreshold, px, py, pixelThreshold) # compute P(Speed|Class) - if speedProbabilities = None: # equiprobable information from speed + if speedProbabilities == None: # equiprobable information from speed userTypeProbabilities = {userType2Num['car']: 1., userType2Num['pedestrian']: 1., userType2Num['bicycle']: 1.} else: userTypeProbabilities = {userType2Num[userTypename]: speedProbabilities[userTypename](self.aggregatedSpeed) for userTypename in speedProbabilities}