# HG changeset patch # User Nicolas Saunier # Date 1689182468 14400 # Node ID 5654c91735485c56c2799ef812ca57b52ff9e682 # Parent eb3936809ea5d5896f719ad7b5e89dc1fdca7bb5# Parent d478d3122804d83006e6fc2cdb23df363568569c merged (bicycle) diff -r d478d3122804 -r 5654c9173548 scripts/classify-objects.py --- a/scripts/classify-objects.py Wed Jul 12 12:12:37 2023 -0400 +++ b/scripts/classify-objects.py Wed Jul 12 13:21:08 2023 -0400 @@ -37,9 +37,9 @@ pedNorm = norm(classifierParams.meanPedestrianSpeed, classifierParams.stdPedestrianSpeed) # numpy lognorm shape, loc, scale: shape for numpy is scale (std of the normal) and scale for numpy is exp(location) (loc=mean of the normal) bicLogNorm = lognorm(classifierParams.scaleCyclistSpeed, loc = 0., scale = np.exp(classifierParams.locationCyclistSpeed)) -speedProbabilities = {'car': lambda s: carNorm.pdf(s), - 'pedestrian': lambda s: pedNorm.pdf(s), - 'cyclist': lambda s: bicLogNorm.pdf(s)} +speedProbabilities = {moving.userTypeNames[1]: lambda s: carNorm.pdf(s), + moving.userTypeNames[2]: lambda s: pedNorm.pdf(s), + moving.userTypeNames[4]: lambda s: bicLogNorm.pdf(s)} if args.plotSpeedDistribution: import matplotlib.pyplot as plt diff -r d478d3122804 -r 5654c9173548 scripts/manual-video-analysis.py --- a/scripts/manual-video-analysis.py Wed Jul 12 12:12:37 2023 -0400 +++ b/scripts/manual-video-analysis.py Wed Jul 12 13:21:08 2023 -0400 @@ -29,7 +29,7 @@ 'car', 'pedestrian', 'motorcycle', - 'cyclist', + 'bicycle', 'bus', 'truck'] class UserConfiguration(object): diff -r d478d3122804 -r 5654c9173548 scripts/polytracktopdtv.py --- a/scripts/polytracktopdtv.py Wed Jul 12 12:12:37 2023 -0400 +++ b/scripts/polytracktopdtv.py Wed Jul 12 13:21:08 2023 -0400 @@ -25,7 +25,7 @@ "1" -> "car" "2" -> "pedestrians" "3" -> "motorcycle" - "4" -> "cyclist" + "4" -> "bicycle" "5" -> "bus" "6" -> "truck" ... and other type if the objects_type table is defined in SQLite''' @@ -38,7 +38,7 @@ typeDict["1"] = "car" typeDict["2"] = "pedestrians" typeDict["3"] = "motorcycle" - typeDict["4"] = "cyclist" + typeDict["4"] = "bicycle" typeDict["5"] = "bus" typeDict["6"] = "truck" diff -r d478d3122804 -r 5654c9173548 scripts/train-object-classification.py --- a/scripts/train-object-classification.py Wed Jul 12 12:12:37 2023 -0400 +++ b/scripts/train-object-classification.py Wed Jul 12 13:21:08 2023 -0400 @@ -22,9 +22,9 @@ args = parser.parse_args() classifierParams = storage.ClassifierParameters(args.configFilename) -imageDirectories = {'pedestrian': args.directoryName + "/Pedestrians/", - 'cyclist': args.directoryName + "/Cyclists/", - 'car': args.directoryName + "/Vehicles/"} +imageDirectories = {moving.userTypeNames[2]: args.directoryName + "/Pedestrians/", + moving.userTypeNames[4]: args.directoryName + "/Cyclists/", + moving.userTypeNames[1]: args.directoryName + "/Vehicles/"} trainingSamplesPBV = {} trainingLabelsPBV = {} @@ -39,11 +39,11 @@ print('Loading {} samples'.format(k)) trainingSamples, trainingLabels = cvutils.createHOGTrainingSet(v, moving.userType2Num[k], classifierParams.hogRescaleSize, classifierParams.hogNOrientations, classifierParams.hogNPixelsPerCell, classifierParams.hogBlockNorm, classifierParams.hogNCellsPerBlock) trainingSamplesPBV[k], trainingLabelsPBV[k] = trainingSamples, trainingLabels - if k != 'pedestrian': + if k != moving.userTypeNames[2]: trainingSamplesBV[k], trainingLabelsBV[k] = trainingSamples, trainingLabels - if k != 'car': + if k != moving.userTypeNames[1]: trainingSamplesPB[k], trainingLabelsPB[k] = trainingSamples, trainingLabels - if k != 'cyclist': + if k != moving.userTypeNames[4]: trainingSamplesPV[k], trainingLabelsPV[k] = trainingSamples, trainingLabels # Training the Support Vector Machine diff -r d478d3122804 -r 5654c9173548 trafficintelligence/moving.py --- a/trafficintelligence/moving.py Wed Jul 12 12:12:37 2023 -0400 +++ b/trafficintelligence/moving.py Wed Jul 12 13:21:08 2023 -0400 @@ -1371,19 +1371,19 @@ 'car', 'pedestrian', 'motorcycle', - 'cyclist', + 'bicycle', 'bus', 'truck', 'automated'] coco2Types = {0: 2, 1: 4, 2: 1, 5: 5, 7: 6} cocoTypeNames = {0: 'person', - 1: 'bicycle', - 2: 'car', - 3: 'motorcycle', - 5: 'bus', - 6: 'train', - 7: 'truck'} + 1: 'bicycle', + 2: 'car', + 3: 'motorcycle', + 5: 'bus', + 6: 'train', + 7: 'truck'} userType2Num = utils.inverseEnumeration(userTypeNames) @@ -2073,7 +2073,7 @@ self.classifyUserTypeHoGSVMAtInstant(images[t], t, homography, width, height, px, py, minNPixels, rescaleSize, orientations, pixelsPerCell, cellsPerBlock) # compute P(Speed|Class) if speedProbabilities is None or self.aggregatedSpeed < minSpeedEquiprobable: # equiprobable information from speed - userTypeProbabilities = {userType2Num['car']: 1., userType2Num['pedestrian']: 1., userType2Num['cyclist']: 1.} + userTypeProbabilities = {userType2Num['car']: 1., userType2Num['pedestrian']: 1., userType2Num['bicycle']: 1.} else: userTypeProbabilities = {userType2Num[userTypename]: speedProbabilities[userTypename](self.aggregatedSpeed) for userTypename in speedProbabilities} # compute P(Class|Appearance)