Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 959:4f32d82ca390
corrected error due to change in Hog (scikit image)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 24 Aug 2017 17:22:24 -0400 |
parents | 196a1fd498ba |
children | 184f1dd307f9 |
line wrap: on
line diff
--- a/python/moving.py Fri Aug 18 18:00:11 2017 -0400 +++ b/python/moving.py Thu Aug 24 17:22:24 2017 -0400 @@ -1108,6 +1108,11 @@ userType2Num = utils.inverseEnumeration(userTypeNames) +class CarClassifier: + def predict(self, hog): + return userType2Num['car'] +carClassifier = CarClassifier() + class MovingObject(STObject, VideoFilenameAddable): '''Class for moving objects: a spatio-temporal object with a trajectory and a geometry (constant volume over time) @@ -1615,10 +1620,7 @@ elif self.aggregatedSpeed < bikeCarSpeedThreshold: self.appearanceClassifier = bikeCarSVM else: - class CarClassifier: - def predict(self, hog): - return userType2Num['car'] - self.appearanceClassifier = CarClassifier() + self.appearanceClassifier = carClassifier # project feature positions if self.hasFeatures(): for f in self.getFeatures(): @@ -1634,7 +1636,7 @@ and applies the SVM model on it''' croppedImg = cvutils.imageBox(img, self, instant, width, height, px, py, minNPixels) if croppedImg is not None and len(croppedImg) > 0: - hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm, visualize=False, normalize=False) + hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm) self.userTypes[instant] = int(self.appearanceClassifier.predict(hog)) else: self.userTypes[instant] = userType2Num['unknown']