Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 956:196a1fd498ba
removing unnecessary complexity of varying number of return elements
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 15 Aug 2017 16:15:55 -0400 |
parents | d6c1c05d11f5 |
children | 4f32d82ca390 |
comparison
equal
deleted
inserted
replaced
955:a15e843af55a | 956:196a1fd498ba |
---|---|
1808 mme = 0 # number of mismatches | 1808 mme = 0 # number of mismatches |
1809 matches = {} # match[i] is the tracker track associated with GT i (using object references) | 1809 matches = {} # match[i] is the tracker track associated with GT i (using object references) |
1810 if returnMatches: | 1810 if returnMatches: |
1811 gtMatches = {a.getNum():{} for a in annotations} | 1811 gtMatches = {a.getNum():{} for a in annotations} |
1812 toMatches = {o.getNum():{} for o in objects} | 1812 toMatches = {o.getNum():{} for o in objects} |
1813 else: | |
1814 gtMatches = None | |
1815 toMatches = None | |
1813 for t in xrange(firstInstant, lastInstant+1): | 1816 for t in xrange(firstInstant, lastInstant+1): |
1814 previousMatches = matches.copy() | 1817 previousMatches = matches.copy() |
1815 # go through currently matched GT-TO and check if they are still matched withing matchingDistance | 1818 # go through currently matched GT-TO and check if they are still matched withing matchingDistance |
1816 toDelete = [] | 1819 toDelete = [] |
1817 for a in matches: | 1820 for a in matches: |
1879 motp = None | 1882 motp = None |
1880 if gt > 0: | 1883 if gt > 0: |
1881 mota = 1.-float(mt+fpt+mme)/gt | 1884 mota = 1.-float(mt+fpt+mme)/gt |
1882 else: | 1885 else: |
1883 mota = None | 1886 mota = None |
1884 if returnMatches: | 1887 return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches |
1885 return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches | |
1886 else: | |
1887 return motp, mota, mt, mme, fpt, gt | |
1888 | 1888 |
1889 def plotRoadUsers(objects, colors): | 1889 def plotRoadUsers(objects, colors): |
1890 '''Colors is a PlottingPropertyValues instance''' | 1890 '''Colors is a PlottingPropertyValues instance''' |
1891 from matplotlib.pyplot import figure, axis | 1891 from matplotlib.pyplot import figure, axis |
1892 figure() | 1892 figure() |