Mercurial Hosting > traffic-intelligence
diff scripts/dltrack.py @ 1240:bb14f919d1cb
cleaned use of centile (np only) and added info in classify-objects
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 05 Feb 2024 14:14:14 -0500 |
parents | b684135d817f |
children | 4cd8ace3552f |
line wrap: on
line diff
--- a/scripts/dltrack.py Fri Oct 06 17:02:32 2023 -0400 +++ b/scripts/dltrack.py Mon Feb 05 14:14:14 2024 -0500 @@ -12,7 +12,7 @@ from trafficintelligence import cvutils, moving, storage, utils -parser = argparse.ArgumentParser(description='The program tracks objects using the ultralytics models and trakcers.')#, epilog = 'Either the configuration filename or the other parameters (at least video and database filenames) need to be provided.') +parser = argparse.ArgumentParser(description='The program tracks objects using the ultralytics models and trakcers.') parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file', required = True) parser.add_argument('-d', dest = 'databaseFilename', help = 'name of the Sqlite database file', required = True) parser.add_argument('-m', dest = 'detectorFilename', help = 'name of the detection model file', required = True) @@ -53,6 +53,9 @@ lastFrameNum = args.lastFrameNum success, frame = capture.read() +if not success: + print('Input {} could not be read. Exiting'.format(args.videoFilename)) + import sys; sys.exit() results = model.track(frame, tracker=args.trackerFilename, classes=list(moving.cocoTypeNames.keys()), persist=True, verbose=False) # create object with user type and list of 3 features (bottom ones and middle) + projection while capture.isOpened() and success and frameNum <= lastFrameNum: