# HG changeset patch # User Nicolas Saunier # Date 1689182468 14400 # Node ID 5654c91735485c56c2799ef812ca57b52ff9e682 # Parent eb3936809ea5d5896f719ad7b5e89dc1fdca7bb5# Parent d478d3122804d83006e6fc2cdb23df363568569c merged (bicycle) diff -r eb3936809ea5 -r 5654c9173548 scripts/classify-objects.py --- a/scripts/classify-objects.py Wed Jul 12 13:14:09 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), - 'bicycle': 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 eb3936809ea5 -r 5654c9173548 scripts/manual-video-analysis.py diff -r eb3936809ea5 -r 5654c9173548 scripts/polytracktopdtv.py diff -r eb3936809ea5 -r 5654c9173548 scripts/train-object-classification.py --- a/scripts/train-object-classification.py Wed Jul 12 13:14:09 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/", - 'bicycle': 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 != 'bicycle': + if k != moving.userTypeNames[4]: trainingSamplesPV[k], trainingLabelsPV[k] = trainingSamples, trainingLabels # Training the Support Vector Machine diff -r eb3936809ea5 -r 5654c9173548 trafficintelligence/moving.py --- a/trafficintelligence/moving.py Wed Jul 12 13:14:09 2023 -0400 +++ b/trafficintelligence/moving.py Wed Jul 12 13:21:08 2023 -0400 @@ -1376,14 +1376,14 @@ 'truck', 'automated'] -coco2UserTypes = {0: 2, 1: 4, 2: 1, 5: 5, 7: 6} -cocoUserTypeNames = {0: 'person', - 1: 'bicycle', - 2: 'car', - 3: 'motorcycle', - 5: 'bus', - 6: 'train', - 7: 'truck'} +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'} userType2Num = utils.inverseEnumeration(userTypeNames)