Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/process.py @ 987:f026ce2af637
found bug with direct ttc computation
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 07 Mar 2018 23:37:00 -0500 |
| parents | 3be8aaa47651 |
| children | dc0be55e2bf5 |
comparison
equal
deleted
inserted
replaced
| 986:3be8aaa47651 | 987:f026ce2af637 |
|---|---|
| 11 from metadata import * | 11 from metadata import * |
| 12 | 12 |
| 13 parser = argparse.ArgumentParser(description='This program manages the processing of several files based on a description of the sites and video data in an SQLite database following the metadata module.') | 13 parser = argparse.ArgumentParser(description='This program manages the processing of several files based on a description of the sites and video data in an SQLite database following the metadata module.') |
| 14 parser.add_argument('--db', dest = 'metadataFilename', help = 'name of the metadata file', required = True) | 14 parser.add_argument('--db', dest = 'metadataFilename', help = 'name of the metadata file', required = True) |
| 15 parser.add_argument('--videos', dest = 'videoIds', help = 'indices of the video sequences', nargs = '*', type = int) | 15 parser.add_argument('--videos', dest = 'videoIds', help = 'indices of the video sequences', nargs = '*', type = int) |
| 16 parser.add_argument('--prediction-method', dest = 'predictionMethod', help = 'prediction method (constant velocity (cvd: vector computation (approximate); cve: equation solving; cv: discrete time (approximate)), normal adaptation, point set prediction)', choices = ['cvd', 'cve', 'cv', 'na', 'ps', 'mp']) | |
| 16 parser.add_argument('--pet', dest = 'computePET', help = 'computes PET', action = 'store_true') | 17 parser.add_argument('--pet', dest = 'computePET', help = 'computes PET', action = 'store_true') |
| 17 parser.add_argument('--delete', dest = 'delete', help = 'data to delete', choices = ['feature', 'object', 'classification', 'interaction']) | 18 parser.add_argument('--delete', dest = 'delete', help = 'data to delete', choices = ['feature', 'object', 'classification', 'interaction']) |
| 18 parser.add_argument('--process', dest = 'process', help = 'data to process', choices = ['feature', 'object', 'classification', 'interaction']) | 19 parser.add_argument('--process', dest = 'process', help = 'data to process', choices = ['feature', 'object', 'classification', 'interaction']) |
| 19 parser.add_argument('--analyze', dest = 'analyze', help = 'data to analyze (results)', choices = ['feature', 'object', 'classification', 'interaction']) | 20 parser.add_argument('--analyze', dest = 'analyze', help = 'data to analyze (results)', choices = ['feature', 'object', 'classification', 'interaction']) |
| 20 | 21 |
| 38 vs = session.query(VideoSequence).get(videoId) | 39 vs = session.query(VideoSequence).get(videoId) |
| 39 storage.deleteFromSqlite(str(parentDir/vs.getDatabaseFilename()), args.delete) | 40 storage.deleteFromSqlite(str(parentDir/vs.getDatabaseFilename()), args.delete) |
| 40 | 41 |
| 41 if args.process == 'interaction': | 42 if args.process == 'interaction': |
| 42 # safety analysis TODO make function in safety analysis script | 43 # safety analysis TODO make function in safety analysis script |
| 43 predictionParameters = prediction.CVDirectPredictionParameters()#prediction.CVExactPredictionParameters() | 44 if args.predictionMethod == 'cvd': |
| 45 predictionParameters = prediction.CVDirectPredictionParameters() | |
| 46 if args.predictionMethod == 'cve': | |
| 47 predictionParameters = prediction.CVExactPredictionParameters() | |
| 44 for videoId in args.videoIds: | 48 for videoId in args.videoIds: |
| 45 vs = session.query(VideoSequence).get(videoId) | 49 vs = session.query(VideoSequence).get(videoId) |
| 46 print('Processing '+vs.getDatabaseFilename()) | 50 print('Processing '+vs.getDatabaseFilename()) |
| 47 objects = storage.loadTrajectoriesFromSqlite(str(parentDir/vs.getDatabaseFilename()), 'object')#, args.nObjects, withFeatures = (params.useFeaturesForPrediction or predictionMethod == 'ps' or predictionMethod == 'mp')) | 51 objects = storage.loadTrajectoriesFromSqlite(str(parentDir/vs.getDatabaseFilename()), 'object')#, args.nObjects, withFeatures = (params.useFeaturesForPrediction or predictionMethod == 'ps' or predictionMethod == 'mp')) |
| 48 interactions = events.createInteractions(objects) | 52 interactions = events.createInteractions(objects) |
