Mercurial Hosting > traffic-intelligence
diff scripts/process.py @ 1049:c9c03c97ed9f
bug fix to store numpy integers in SQLite
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 06 Jul 2018 15:58:45 -0400 |
parents | 27a822922cb0 |
children | 9d4a06f49cb8 |
line wrap: on
line diff
--- a/scripts/process.py Fri Jul 06 11:13:10 2018 -0400 +++ b/scripts/process.py Fri Jul 06 15:58:45 2018 -0400 @@ -168,7 +168,7 @@ lcss = utils.LCSS(metric = args.metric, epsilon = args.epsilon) similarityFunc = lambda x,y : lcss.computeNormalized(x, y) trainingObjects = [o for tmpobjects in objects.values() for o in tmpobjects] - if args.nMPObjects is not None: + if args.nMPObjects is not None and args.nMPObjects < len(trainingObjects): m = int(np.floor(float(len(trainingObjects))/args.nMPObjects)) trainingObjects = trainingObjects[::m] similarities = -np.ones((len(trainingObjects), len(trainingObjects))) @@ -179,7 +179,6 @@ outputPrototypeDatabaseFilename = args.outputPrototypeDatabaseFilename # TODO maintain mapping from object prototype to db filename + compute nmatchings before clusterSizes = ml.computeClusterSizes(labels, prototypeIndices, -1) - #print([clusterSizes[i] for i in prototypeIndices]) storage.savePrototypesToSqlite(str(parentPath/site.getPath()/outputPrototypeDatabaseFilename), [moving.Prototype(object2VideoSequences[trainingObjects[i]].getDatabaseFilename(False), trainingObjects[i].getNum(), prototypeType, clusterSizes[i]) for i in prototypeIndices])