tvaLib
comp.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # tvaLib Copyright (c) 2012-2016 Paul G. St-Aubin
3 # Ecole Polytechnique de Montreal, McGill University
4 # Python 2.7; (dt) Spyder Windows 10 64-bit; ipython Ubuntu 15.04 64-bit
5 
9 import os, sys
10 import math as m
11 from datetime import datetime
12 from inspect import getfile as inspect_getfile
13 from inspect import currentframe as inspect_currentframe
14 
15 try: import numpy as np
16 except Exception: raise Exception, [0101, 'Numpy is not installed.']
17 
18 if __name__ == "__main__":
19  print('Computational library loaded directly.')
20  sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(inspect_getfile(inspect_currentframe())))))
21 import lib.tools as tvaLib
22 
23 
24 
27 def computeSpeedHisto(objects, by='', for_=None, bins=np.arange(0.0, 80.0, 1.0), framerate=15.0, mps_kmh=3.6, verbose=0):
28  ''' Compile all speeds and produce histogram.
29 
30  Input:
31  ======
32  objects: can be passed as an ordinary list or as a nested camera/sequence ObjectSpace type.
33  constantFramerate: pass this if objects isn't an objectSpace type.
34  by: optional method of aggregation passed as a string. options: lane|class
35  for_: corresponding aggregation criteria
36 
37  Output:
38  =======
39  Returns a 3 by nBins matrix containing the following rows:
40  0 = Bin stops (not including the starting bin offset) (x-axis)
41  1 = Bin counts (aka frequency) (y-axis 1)
42  2 = Bin probability (aka PDF) (y-axis 2)
43  '''
44 
45  if(verbose >= 2 and by): print(' Compiling speed histogram ('+by+' '+str(for_)+')...')
46  elif(verbose >= 2): print(' Compiling speed histogram...')
47  speeds = []
48  for obj in objects:
49  if(hasattr(obj, 'framrate')): obj_framerate = obj.framerate
50  else: obj_framerate = framerate
51  if(by=='lane' and hasattr(obj, 'curvilinearPositions')):
52  speeds_of_user = [speed*float(obj_framerate)*float(mps_kmh) for speed,curvy in zip(obj.getSpeeds(), obj.getCurvilinearPositions()) if for_ == curvy[2]]
53  if(speeds_of_user):
54  speeds.append(sum(speeds_of_user)/float(len(speeds_of_user)))
55  elif(by=='class' and hasattr(obj, 'userType')):
56  if(obj.getUserType() == for_):
57  speeds_of_user = [speed*float(obj_framerate)*float(mps_kmh) for speed in obj.getSpeeds()]
58  if(speeds_of_user):
59  speeds.append(sum(speeds_of_user)/float(len(speeds_of_user)))
60  else:
61  speeds += list(obj.getSpeeds()*float(obj_framerate)*float(mps_kmh))
62 
63  speed_histo = np.histogram(speeds,bins=bins)
64  if(np.sum(speed_histo[0])): speed_histo += (speed_histo[0].astype(float)/np.sum(speed_histo[0]),)
65  else: speed_histo += (speed_histo[0].astype(float),)
66  return [list(speed_histo[1]),list(speed_histo[0]),list(speed_histo[2])]
67 
68 def computeSpeedHistoByLane(objects, alignments, by='lane', for_=None, **kwargs):
69  ''' Wrapper for computeSpeedHisto to aggregate by lane '''
70 
71  speed_histo_by_lane = {}
72  for lane in range(len(alignments)):
73  result = computeSpeedHisto(objects, by='lane', for_=lane, **kwargs)
74  if(sum(result[1])):
75  speed_histo_by_lane[lane] = result
76  return speed_histo_by_lane
77 
78 def computeSpeedHistoByClass(objects, user_class_variety, by='class', for_=None, **kwargs):
79  ''' Wrapper for computeSpeedHisto to aggregate by class '''
80 
81  speed_histo_by_class = {}
82  for class_ in user_class_variety:
83  if(user_class_variety[class_]):
84  speed_histo_by_class[class_] = computeSpeedHisto(objects, by='class', for_=class_, **kwargs)
85  return speed_histo_by_class
86 
87 
88 def computeSpeedProf(objects, alignments, bins=80, framerate=15.0, mps_kmh=3.6, verbose=0):
89  ''' Compile all speeds for given lane and produce function of
90  mean/deviation speed along profile.
91 
92  Input:
93  ======
94  objects: can be passed as an ordinary list or as a nested camera/sequence ObjectSpace type.
95  framerate: pass speed
96 
97  Output:
98  =======
99  speed_by_lane
100  speed_by_lane[align] #Tuple encapsulating every align
101  speed_by_lane[align][0][bin][obs] #List of all observations associated with align at bin
102  speed_by_lane[align][1][bin] #List of value at all bins for align
103  speed_by_lane[align][2][bin] #List of mean at all bins for align
104  speed_by_lane[align][3][bin] #List of st. dev. at all bins for align
105 
106  slsd
107  slsd[align] #List encapsulating every align
108  slsd[align][0][bin] #List of histogram values (Y)
109  slsd[align][1][bin] #List of histogram bins (X)
110  '''
111 
112  if(verbose >= 2): print(' Compiling speed data (per lane distribution)...')
113 
114 
115  ss_align_d = []
116  for align in range(len(alignments)):
117  ss_align_d.append(np.zeros(len(alignments[align])))
118  for align_p in range(len(alignments[align])):
119  if align_p > (len(alignments[align]) - 2):
120  break
121  ss_align_d[align][align_p] = tvaLib.Geo.ppd(alignments[align].pos[align_p][0],alignments[align].pos[align_p][1],alignments[align].pos[(align_p+1)][0],alignments[align].pos[(align_p+1)][1])
122 
123  #First, generate data structure
124  speed_by_lane = tuple([[],[],[],[]] for i in range(len(alignments))) #Speed distribution by lane
125  slsd = [[[],[]] for i in range(len(alignments))] #Position histogram for each lane
126  slsd_data = [[] for i in range(len(alignments))]
127  for align in range(len(alignments)):
128  #Generate bins
129  bin_length = (sum(ss_align_d[align]))/bins
130  j = 0
131  while (j < bins+1):
132  speed_by_lane[align][0].append([])
133  speed_by_lane[align][1].append(bin_length*j)
134  speed_by_lane[align][2].append(0)
135  speed_by_lane[align][3].append(0)
136  j += 1
137 
138 
139  for obj in objects:
140  if(hasattr(obj, 'framrate')): obj_framerate = obj.framerate
141  else: obj_framerate = framerate
142  for point in range(len(obj.positions.positions[0])):
143  align = obj.curvilinearPositions.getLanes()[point]
144  slsd_data[align].append(obj.curvilinearPositions.getXCoordinates()[point])
145  for bin_i in range(len(speed_by_lane[align][1])):
146  if(obj.curvilinearPositions.getXCoordinates()[point] < speed_by_lane[align][1][bin_i]):
147  try: speed_by_lane[align][0][bin_i].append(obj.velocities.positions[2][point]*float(obj_framerate)*float(mps_kmh))
148  except: tvaLib.printWarning('The length of positions does not match the length of velocities for object #'+str(obj.num)+'. This object will be ignored')
149  break
150 
151  #Generate mean and STD for each bin
152  for align in range(len(speed_by_lane)):
153  for i in range(len(speed_by_lane[align][2])):
154  speed_by_lane[align][2][i] = np.array(speed_by_lane[align][0][i]).mean() if len(speed_by_lane[align][0][i]) > 0 else float('nan')
155  speed_by_lane[align][3][i] = np.array(speed_by_lane[align][0][i]).std() if len(speed_by_lane[align][0][i]) > 0 else float('nan')
156 
157  #Generate slsd histogram
158  for align in range(len(alignments)):
159  slsd[align][0],slsd[align][1] = np.histogram(slsd_data[align],speed_by_lane[align][1])
160 
161  return speed_by_lane, slsd
162 
163 def computeClassificationVariety(objects, verbose=0):
164  ''' Compute classification variety and return as dict with number of observations
165  '''
166  classificationVariety = {0:0}
167  for obj in objects:
168  if(hasattr(obj, 'userType')):
169  if(obj.getUserType() in classificationVariety): classificationVariety[obj.getUserType()] += 1
170  else: classificationVariety[obj.getUserType()] = 1
171  else:
172  classificationVariety[0] += 1
173  return classificationVariety
174 
175 
176 
177 def timeHorizon(objects, return_max=False, return_stats=False, verbose=0):
178  ''' Compute the timehorizon from a large list of objects.
179 
180  Output:
181  =======
182  returns the maximum timehorizon if return_max is True, otherwise
183  returns statistics about timehorizon: [min, max, mean, std.dev, median]
184  '''
185  if(verbose >= 2): print(' Evaluating object timehorizon...')
186 
187  timeHorizon_list = []
188  for i in objects:
189  timeHorizon_list.append(int(i.length()))
190 
191  if(not timeHorizon_list): return False
192 
193  min_ = min(timeHorizon_list)
194  max_ = max(timeHorizon_list)
195  mean_ = np.mean(timeHorizon_list)
196  sdt_ = np.std(timeHorizon_list)
197  med_ = np.median(timeHorizon_list)
198 
199  if(verbose >= 2): print(' min={0}, max={1}, mean={2}, std.dev={3}, median={4}'.format(min_, max_, mean_, sdt_, med_))
200 
201  if(return_max): return max_
202  elif(return_stats): return [min_, max_, mean_, sdt_, med_]
203  else: return timeHorizon_list
204 
205 
206 def computeLaneChanges(objects, alignments, mode=0, verbose=0):
207  ''' Compile lane changes.
208 
209  Input:
210  ======
211  mode=0: Simple: Check in lane and out lane (e.g. an OD matrix)
212  mode=1: Complex: Check every lane change (requires solid confidence in lane association)
213  '''
214  if(verbose >= 2):
215  if(mode==1): print(' Compiling lane changes...')
216  else: print(' Compiling origin-destination counts...')
217 
218 
219  lc = [[0 for y in range(len(alignments))] for x in range(len(alignments))]
220 
221 
222  if(type(objects) is list): objects_ = objects
223  else: objects_ = objects.getAll()
224 
225 
226  if(mode==1):
227  for i in range(len(objects_)):
228  for point in range(len(objects_[i].positions.positions[0])-1):
229  if objects_[i].curvilinearPositions.getLanes()[point] != objects_[i].curvilinearPositions.getLanes()[point+1]:
230  lc[objects_[i].curvilinearPositions.getLanes()[point]][objects_[i].curvilinearPositions.getLanes()[point+1]] += 1
231  if(verbose >= 3): print(' Compilation report: Average lane changes per object: '+str(float(sum(map(sum, lc)))/len(objects_)))
232 
233  else:
234  for i in range(len(objects_)):
235  lc[objects_[i].curvilinearPositions.getLanes()[0]][objects_[i].curvilinearPositions.getLanes()[-1]] += 1
236  return lc
237 
238 
239 def computeLaneChangesOverTime(objects, timestep=15, verbose=0, *args, **kwargs):
240  ''' Run computeLaneChanges aggregated over individual time steps (in
241  minutes). Expects object space. '''
242  if(verbose >= 2): print(' Compiling OD/lane changes over time...')
243 
244  timesteps = int(round(24*60/float(timestep)))
245  lc = []
246  for t in range(timesteps-1):
247  start = datetime(2000,01,01, t*24/timesteps, t*timestep%60).time()
248  end = datetime(2000,01,01, (t+1)*24/timesteps, (t+1)*timestep%60).time()
249  lc.append(computeLaneChanges(objects.getSubSpacebyTime(start,end), verbose=0, *args, **kwargs))
250  return lc
251 
252 
253 def dumpLaneRatios(objects, alignments, stations=2, verbose=0):
254  ''' Compile lane ratios (currently not used). '''
255  if(verbose >= 2): print(' Compiling lane ratios...')
256 
257  # Generate Lane ratio matrix
258  #Variable station size not yet supported
259  lr = []
260  for station in range(stations):
261  lr.append([])
262  for lane in alignments:
263  lr[station].append(0)
264 
265  for i in range(len(objects)):
266  lr[0][[i].curvilinearPositions.getLanes()] = 1
267  return lr
268 
269 
270 def featureTreatment(objects, objectsToCheck, alignments, ln_mv_av_win=3, minNegativetreshold = 1):
271  ''' Getting feature's SYfromSY to find out alignements.
272 
273  Return Objects who are snapped twice on the same lane and objects who
274  go in the wrong way.
275 
276  TODO: This function is deprecated and non-standard. Future review
277  necessary. --pstaub
278  '''
279 
280  class Construct:
281  def __init__(self, objects, Reverse, double):
282  self.objectsToCheck = objects
283  self.ReverseFeatures = Reverse
284  self.doubleLaneFeatures = double
285 
286  ObjectsChecked = Construct([],[],[])
287  for i in objectsToCheck:
288  FeaturesLane = []
289  FeaturesSCoordinates = []
290  for f in range(len(objects[0][i].features)):
291  Align = []
292  Si = []
293  #For each point
294  for point in range(len(objects[0][i].features[f].getXCoordinates())):
295  if point % 2 == 0:
296  [align, alignPoint, snapped_x, snapped_y, subsegmentDistance, S, Y] = tvaLib.Geo.getSYfromXY(objects[0][i].features[f].getXCoordinates()[point],objects[0][i].features[f].getYCoordinates()[point],alignments)
297 
298  Align.append(align)
299  Si.append(S)
300 
301 
303  smoothed_lanes = tvaLib.Math.cat_mvgavg(Align,window=ln_mv_av_win)
304 
305 
306  if(Align != smoothed_lanes):
307  for point in range(len(objects[0][i].features[f].getXCoordinates())):
308  if point % 2 == 0:
309  if(Align[point/2] != smoothed_lanes[point/2]):
310  [align, alignPoint, snapped_x, snapped_y, subsegmentDistance, S, Y] = tvaLib.Geo.getSYfromXY(objects[0][i].features[f].getXCoordinates()[point],objects[0][i].features[f].getYCoordinates()[point],[alignments[smoothed_lanes[point/2]]])
311 
312  Align[point/2] = align
313  Si[point/2] = S
314 
315  FeaturesLane.append(Align)
316  FeaturesSCoordinates.append(Si)
317 
318  #check lane order and finds first frame of each lane
319  for w in range(len(FeaturesLane)):
320  #Checking if the getSYfromXY fonction failed to snap all points
321  if len([i for i in FeaturesLane[w] if i is False]) == len(FeaturesLane[w]):
322  break
323  else:
324  FeatureLaneExtremum = [0]
325  FeatureOrder = []
326  for x in range(len(FeaturesLane[w])):
327  if x < len(FeaturesLane[w])-1:
328  if FeaturesLane[w][x] != FeaturesLane[w][x+1]:
329  FeatureOrder.append(FeaturesLane[w][x])
330  FeatureLaneExtremum.append(x+1)
331 
332  elif x == len(FeaturesLane[w])-1 and len(FeatureOrder)>=1:
333  if FeaturesLane[w][x] != FeatureOrder[-1]:
334  FeatureOrder.append(FeaturesLane[w][x])
335  FeatureLaneExtremum.append(x+1)
336 
337  elif x == len(FeaturesLane[w])-1 and len(FeatureOrder)<1:
338  FeatureOrder.append(FeaturesLane[w][x])
339  FeatureLaneExtremum.append(x+1)
340 
341  #first check if Lane appears more than once. Result could be useful to add more crieria for double lane roundabouts
342  #Then a wrong way infraction is deemed commited when the global tracjectory on a segment is negative
343  for j in range(len(FeatureOrder)):
344  if FeatureOrder.count(j) > 1:
345  ObjectsChecked.objectsToCheck.append(i)
346  ObjectsChecked.doubleLaneFeatures.append(w)
347  break
348 
349  elif (FeaturesSCoordinates[w][FeatureLaneExtremum[j+1]-1] - FeaturesSCoordinates[w][FeatureLaneExtremum[j]]) < -minNegativetreshold:
350  ObjectsChecked.objectsToCheck.append(i)
351  ObjectsChecked.ReverseFeatures.append(w)
352  break
353 
354  return ObjectsChecked
355 
356 def computeInfractions(objects, alignments, minNegativetreshold = 2, PourTreshold = 10, verbose=0):
357  ''' Detect wrong way trajectories.
358 
359  First check for unusual object trajectories, then investiguate the
360  features composing the objects to see if the trajectories are actually
361  problematic or if it is the result of a bug from the object creation
362  sourcecode.
363  '''
364 
365  class Infraction:
366  def __init__(self, infww, WWfirstFrames):
367  self.WrongWay = infww
368  self.WrongWayFirstFrames = WWfirstFrames
369 
370  Infractions = Infraction([],[])
371  Count = 0
372  if(verbose >= 2):
373  print(' -------------')
374  print(' Compiling infractions...')
375 
376  for i in range(len(objects[0])):
377  LaneExtremum = [0]
378  Order = []
379 
380  #check lane order and finds first frame of each lane
381  for x in range(len(objects[0][i].curvilinearPositions.lanes)):
382  if x < len(objects[0][i].curvilinearPositions.lanes)-1:
383  if objects[0][i].curvilinearPositions.lanes[x] != objects[0][i].curvilinearPositions.lanes[x+1]:
384  Order.append(objects[0][i].curvilinearPositions.lanes[x])
385  LaneExtremum.append(x+1)
386 
387  if x == len(objects[0][i].curvilinearPositions.lanes)-1 and len(Order)>=1:
388  if objects[0][i].curvilinearPositions.lanes[x] != Order[-1]:
389  Order.append(objects[0][i].curvilinearPositions.lanes[x])
390  LaneExtremum.append(x+1)
391 
392  #A wrong way infraction is deemed commited when the global tracjectory on a segment is negative
393  #To avoid flagging too many camera errors, the minNegativetreshold should be set higher than 0
394  for j in range(len(Order)):
395  if (objects[0][i].curvilinearPositions.getXCoordinates()[LaneExtremum[j+1]-1] - objects[0][i].curvilinearPositions.getXCoordinates()[LaneExtremum[j]]) < -minNegativetreshold:
396  #Detected trajectories are checked on the feature level to ensure that it is a true infraction
397  ObjectChecked = featureTreatment(objects, [i], alignments, minNegativetreshold = minNegativetreshold)
398  Count += 1
399  #The threshold to determine if a trajectory should be flagged is set to 10% of all features being returned as problematic
400  if 100*len(ObjectChecked.ReverseFeatures)/len(objects[0][i].features) > PourTreshold:
401  Infractions.WrongWay.append(i)
402  Infractions.WrongWayFirstFrames.append(objects[0][i].getFirstInstant())
403 
404  if(verbose >= 2):
405  print(' Compilation report: Number of wrong way infractions: '+str(len(Infractions.WrongWay)))
406  return Infractions
407 
408 
411 def motaWorker(args):
412  ''' Mota calculation pool worker.
413 
414  TrafIntMoving.computeClearMOT(), and hence this function, returns a list:
415 
416  0: motp: total distance between GT and TO / number of associations between GT and tracker output in each frame
417  1: mota: 1.-float(mt+fpt+mme)/gt
418  2: mt: number of missed GT.frames (sum of the number of GT not detected in each frame)
419  3: mme: number of mismatches
420  4: fpt: number of false alarm.frames (tracker objects without match in each frame)
421  5: gt: number of GT.frames
422 
423  '''
424  import lib.filt as tvaFilter
425  import moving as TrafIntMoving
426 
427  cIx = args['cIx']
428  config = args['config']
429  commands = args['commands']
430  seq_objects_src = args['seq_objects_src']
431  zone = args['zone']
432  mask = args['mask']
433  frameRate = args['frameRate']
434  camOrigin = args['camOrigin']
435  camHeight = args['camHeight']
436  chromosomes = args['chromosomes']
437  annotations = args['annotations']
438  firstInstant = args['firstInstant']
439  lastInstant = args['lastInstant']
440  process_file_ids = args['process_file_ids']
441 
442 
443  if(commands.mota_opt_f): seq_objects = seq_objects_src
444  else: seq_objects = tvaLib.Obj.loadObjects(os.path.join(config.temp_dir, process_file_ids[cIx]+'-opt.sqlite'), max_obj_features=config.max_obj_features, suppress_features=True)
445  if(not commands.no_filt):
446  seq_objects = tvaFilter.corVelIndex(seq_objects, verbose=0)
447  seq_objects, _ = tvaFilter.verifyObjectIntegrity(seq_objects, ignoreFeatures=True, verbose=0)
448  seq_objects = tvaFilter.compensateParralax(seq_objects, camOrigin, camHeight, verbose=0)
449  if(commands.mota_opt_f):
450  seq_objects = tvaFilter.compensateParralax(seq_objects, camOrigin, camHeight, verbose=0)
451  seq_objects = tvaFilter.smoothPositions(seq_objects, verbose=0)
452  seq_objects, _ = tvaFilter.filtBoundingBox(seq_objects, zone, containment_threshold=config.f_bb_containment_threshold, max_outside_dist=config.f_bb_max_outside_dist, loopback_verification_frames=chromosomes[cIx]['params']['f-bb-loopback_verification_frames'], bounding_boxes_label='analysis zone', verbose=0)
453  seq_objects, _ = tvaFilter.splitbyOutlierVectors(seq_objects, hard_maxSpeed=chromosomes[cIx]['params']['f-so-hard_maxSpeed'], soft_maxSpeed=chromosomes[cIx]['params']['f-so-soft_maxSpeed'], maxAngle=['params']['f-so-max_angle'], verbose=0)
454  seq_objects, _ = tvaFilter.dropTrackingErrors(seq_objects, config_min_traj_len=chromosomes[cIx]['params']['f-te-config_min_traj_len'], verbose=0)
455  seq_objects, _ = tvaFilter.dropTrackingDuplicates(seq_objects, minimumSeperationDistance=chromosomes[cIx]['params']['f-td-minimumSeperationDistance'], minimumSeperationVelocity=chromosomes[cIx]['params']['f-td-minimumSeperationVelocity']/frameRate/config.mps_kmh, verbose=0)
456  seq_objects, _ = tvaFilter.objectStitch(seq_objects,mask, frameRate, max_dwell_time=chromosomes[cIx]['params']['f-fs-max_dwell_time'], search_radius=chromosomes[cIx]['params']['f-fs-search_radius'], search_window=chromosomes[cIx]['params']['f-fs-search_window'], speed_adj_factor=chromosomes[cIx]['params']['f-fs-speed_adj_factor'], speed_similarity_limit=chromosomes[cIx]['params']['f-fs-speed_similarity_limit'], speed_sim_limit_min=chromosomes[cIx]['params']['f-fs-speed_sim_limit_min'], stop_speed_detection_limit=chromosomes[cIx]['params']['f-fs-stop_speed_detection_limit'], angle_similairty_deg=chromosomes[cIx]['params']['f-fs-angle_similairty_deg'], verbose=0)
457  else:
458  seq_objects,_ = tvaFilter.filtBoundingBox(seq_objects, zone, containment_threshold=config.f_bb_containment_threshold, max_outside_dist=config.f_bb_max_outside_dist, loopback_verification_frames=config.f_bb_loopback_ver_frames, bounding_boxes_label='analysis zone', verbose=0)
459 
460  return TrafIntMoving.computeClearMOT(annotations, seq_objects, config.MOT_max_distance, firstInstant=firstInstant, lastInstant=lastInstant)+(len(annotations),len(seq_objects))
461 
462 def normaliseMOTscore(motp=None, mota=None, n_annot=None, n_tracked=None, annot_class=None, tracked_class=None):
463  try:
464 
465  if(motp is not None): motp_weight = 30
466  else: motp_weight = 0
467  if(mota is not None): mota_weight = 55
468  else: mota_weight = 0
469  if(n_annot is not None and n_tracked is not None): count_weight = 15
470  else: count_weight = 0
471  if(annot_class is not None and tracked_class is not None): class_weight = 15
472  else: class_weight = 0
473 
474  if(motp is not None): motp = 1-min(1,(motp-1)/3.0)
475  else: motp = 0
476  if(mota is not None): mota = (mota+1)/2.0
477  else: mota = 0
478  if(n_annot is not None and n_tracked is not None): n = 1-abs(n_annot-n_tracked)/float(max(n_annot,n_tracked))
479  else: n = 0
480  if(annot_class is not None and tracked_class is not None): class_ = sum([1-abs(a-t)/max(a,t) for a,t in zip(annot_class,tracked_class) if max(a,t) != 0])/float(len(annot_class))
481  else: class_ = 0
482 
483 
484  return (motp*motp_weight + mota*mota_weight + n*count_weight + class_*class_weight)/float(sum([motp_weight,mota_weight,count_weight,class_weight]))
485  except: return 0
486 
def featureTreatment(objects, objectsToCheck, alignments, ln_mv_av_win=3, minNegativetreshold=1)
Definition: comp.py:270
def computeSpeedHistoByLane(objects, alignments, by='lane', for_=None, kwargs)
Definition: comp.py:68
def computeSpeedHistoByClass(objects, user_class_variety, by='class', for_=None, kwargs)
Definition: comp.py:78
def normaliseMOTscore(motp=None, mota=None, n_annot=None, n_tracked=None, annot_class=None, tracked_class=None)
Definition: comp.py:462
def computeClassificationVariety(objects, verbose=0)
Definition: comp.py:163
def timeHorizon(objects, return_max=False, return_stats=False, verbose=0)
Definition: comp.py:177
def computeLaneChangesOverTime(objects, timestep=15, verbose=0, args, kwargs)
Definition: comp.py:239
def dumpLaneRatios(objects, alignments, stations=2, verbose=0)
Definition: comp.py:253
def computeSpeedHisto(objects, by='', for_=None, bins=np.arange(0.0, 80.0, 1.0), framerate=15.0, mps_kmh=3.6, verbose=0)
Computational Library.
Definition: comp.py:27
def computeInfractions(objects, alignments, minNegativetreshold=2, PourTreshold=10, verbose=0)
Definition: comp.py:356
def computeLaneChanges(objects, alignments, mode=0, verbose=0)
Definition: comp.py:206
def motaWorker(args)
Main.py pool workers.
Definition: comp.py:411
def computeSpeedProf(objects, alignments, bins=80, framerate=15.0, mps_kmh=3.6, verbose=0)
Definition: comp.py:88
Definition: filt.py:1