Mercurial Hosting > traffic-intelligence
comparison scripts/dltrack.py @ 1229:759d76d6d20c
minor variable name update
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 13 Jul 2023 17:40:37 -0400 |
parents | 5a207c838323 |
children | c582b272108f |
comparison
equal
deleted
inserted
replaced
1228:5654c9173548 | 1229:759d76d6d20c |
---|---|
1 #! /usr/bin/env python3 | 1 #! /usr/bin/env python3 |
2 # from https://docs.ultralytics.com/modes/track/ | 2 # from https://docs.ultralytics.com/modes/track/ |
3 import sys, argparse | 3 import sys, argparse |
4 | 4 |
5 from trafficintelligence.moving import cocoUserTypeNames | 5 from trafficintelligence.moving import cocoTypeNames |
6 from ultralytics import YOLO | 6 from ultralytics import YOLO |
7 | 7 |
8 parser = argparse.ArgumentParser(description='The program tracks objects following the ultralytics yolo executable.')#, epilog = 'Either the configuration filename or the other parameters (at least video and database filenames) need to be provided.') | 8 parser = argparse.ArgumentParser(description='The program tracks objects following the ultralytics yolo executable.')#, epilog = 'Either the configuration filename or the other parameters (at least video and database filenames) need to be provided.') |
9 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (overrides the configuration file)') | 9 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (overrides the configuration file)') |
10 # detect model | 10 # detect model |
17 # seg could be used on cropped image... if can be loaded and kept in memory | 17 # seg could be used on cropped image... if can be loaded and kept in memory |
18 # model = YOLO('/home/nicolas/Research/Data/classification-models/yolo_nas_l.pt ') # AttributeError: 'YoloNAS_L' object has no attribute 'get' | 18 # model = YOLO('/home/nicolas/Research/Data/classification-models/yolo_nas_l.pt ') # AttributeError: 'YoloNAS_L' object has no attribute 'get' |
19 | 19 |
20 # Track with the model | 20 # Track with the model |
21 if args.display: | 21 if args.display: |
22 results = model.track(source=args.videoFilename, tracker="/home/nicolas/Research/Data/classification-models/bytetrack.yaml", classes=list(cocoUserTypeNames.keys()), show=True) # , save_txt=True | 22 results = model.track(source=args.videoFilename, tracker="/home/nicolas/Research/Data/classification-models/bytetrack.yaml", classes=list(cocoTypeNames.keys()), show=True) # , save_txt=True |
23 else: | 23 else: |
24 results = model.track(source=args.videoFilename, tracker="/home/nicolas/Research/Data/classification-models/bytetrack.yaml", classes=list(cocoUserTypeNames.keys()), stream=True) | 24 results = model.track(source=args.videoFilename, tracker="/home/nicolas/Research/Data/classification-models/bytetrack.yaml", classes=list(cocoTypeNames.keys()), stream=True) |
25 for result in results: | 25 for result in results: |
26 for box in result.boxes: | 26 for box in result.boxes: |
27 print(box.xyxy) | 27 print(box.xyxy) |