changeset 899:1466a63dd1cf

added a new classification parameter
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 21 Jun 2017 17:44:09 -0400
parents 1fc901d983ed
children 85b81c46c526
files classifier.cfg python/storage.py scripts/classify-objects.py
diffstat 3 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/classifier.cfg	Wed Jun 21 17:21:03 2017 -0400
+++ b/classifier.cfg	Wed Jun 21 17:44:09 2017 -0400
@@ -24,6 +24,8 @@
 speed-aggregation-quantile = 50
 # speed value below which all classes are equiprobable (distributions give odd values there) (km/h)
 min-speed-equiprobable = 3.33
+# maximum proportion of the instants with unknow appearance classification to use speed information
+max-prop-unknown-appearance = 0.66
 # maximum pedestrian speed (agregate: mean, median, 85th centile, etc.) 10 km/h
 max-ped-speed = 10.0
 # maximum cyclist speed (agregate: mean, median, 85th centile, etc.) 30 km/h (3xped)
--- a/python/storage.py	Wed Jun 21 17:21:03 2017 -0400
+++ b/python/storage.py	Wed Jun 21 17:44:09 2017 -0400
@@ -1274,6 +1274,7 @@
         self.nFramesIgnoreAtEnds = config.getint(self.sectionHeader, 'nframes-ignore-at-ends')
         self.speedAggregationQuantile = config.getint(self.sectionHeader, 'speed-aggregation-quantile')
         self.minSpeedEquiprobable = config.getfloat(self.sectionHeader, 'min-speed-equiprobable')
+        self.maxPercentUnknown = config.getfloat(self.sectionHeader, 'max-prop-unknown-appearance')
         self.maxPedestrianSpeed = config.getfloat(self.sectionHeader, 'max-ped-speed')
         self.maxCyclistSpeed = config.getfloat(self.sectionHeader, 'max-cyc-speed')
         self.meanPedestrianSpeed = config.getfloat(self.sectionHeader, 'mean-ped-speed')
--- a/scripts/classify-objects.py	Wed Jun 21 17:21:03 2017 -0400
+++ b/scripts/classify-objects.py	Wed Jun 21 17:44:09 2017 -0400
@@ -114,7 +114,7 @@
                         obj.initClassifyUserTypeHoGSVM(speedAggregationFunc, pedBikeCarSVM, bikeCarSVM, classifierParams.maxPedestrianSpeed, classifierParams.maxCyclistSpeed, classifierParams.nFramesIgnoreAtEnds)
                         currentObjects.append(obj)
                     elif inter.last == frameNum:
-                        obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = classifierParams.minSpeedEquiprobable, speedProbabilities = speedProbabilities, maxPercentUnknown = 0.5) # todo add maxPercentUnknown in cfg
+                        obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = classifierParams.minSpeedEquiprobable, speedProbabilities = speedProbabilities, maxPercentUnknown = classifierParams.maxPercentUnknown)
                         pastObjects.append(obj)
                     else:
                         obj.classifyUserTypeHoGSVMAtInstant(img, frameNum, invHomography, width, height, classifierParams.percentIncreaseCrop, classifierParams.percentIncreaseCrop, classifierParams.minNPixels, classifierParams.hogRescaleSize, classifierParams.hogNOrientations, classifierParams.hogNPixelsPerCell, classifierParams.hogNCellsPerBlock, classifierParams.hogBlockNorm)
@@ -125,7 +125,7 @@
         frameNum += 1
     
     for obj in objects:
-        obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = classifierParams.minSpeedEquiprobable, speedProbabilities = speedProbabilities)
+        obj.classifyUserTypeHoGSVM(minSpeedEquiprobable = classifierParams.minSpeedEquiprobable, speedProbabilities = speedProbabilities, maxPercentUnknown = classifierParams.maxPercentUnknown)
         pastObjects.append(obj)
     print('Saving user types')
     storage.setRoadUserTypes(databaseFilename, pastObjects)