# HG changeset patch # User Nicolas Saunier # Date 1529442470 14400 # Node ID d0e339359d8ad505cc14303418299bd52845d571 # Parent 045cb04ad7b842335ba3521217156db1f2a23169 work in progress diff -r 045cb04ad7b8 -r d0e339359d8a scripts/learn-motion-patterns.py --- a/scripts/learn-motion-patterns.py Tue Jun 19 17:07:35 2018 -0400 +++ b/scripts/learn-motion-patterns.py Tue Jun 19 17:07:50 2018 -0400 @@ -75,11 +75,12 @@ # the next line can be called again without reinitializing similarities if args.learn: prototypeIndices = ml.prototypeCluster(trajectories, similarities, args.minSimilarity, similarityFunc, args.optimizeCentroid, args.randomInitialization, initialPrototypeIndices) -# assignment is done if explicitly passed as argument or if working on the same database (starting prototypes from scratch and assigning them) else: prototypeIndices = initialPrototypeIndices if args.assign: + if not args.learn and args.minClusterSize >= 1: + print('Warning: you did not learn the prototypes and you are using minimum cluster size of {}, which may lead to removing prototypes and assigning them to others'.format(args.minClusterSize)) prototypeIndices, labels = ml.assignToPrototypeClusters(trajectories, prototypeIndices, similarities, args.minSimilarity, similarityFunc, args.minClusterSize) clusterSizes = ml.computeClusterSizes(labels, prototypeIndices, -1) print(clusterSizes) @@ -89,10 +90,11 @@ for i in prototypeIndices: if args.assign: nMatchings = clusterSizes[i]-1 - else: - nMatchings = 0 + #else: + # nMatchings = 0 if i