Meta Byte Track
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

basetrack.py 950B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import numpy as np
  2. from collections import OrderedDict
  3. class TrackState(object):
  4. New = 0
  5. Tracked = 1
  6. Lost = 2
  7. Removed = 3
  8. class BaseTrack(object):
  9. _count = 0
  10. track_id = 0
  11. is_activated = False
  12. state = TrackState.New
  13. history = OrderedDict()
  14. features = []
  15. curr_feature = None
  16. score = 0
  17. start_frame = 0
  18. frame_id = 0
  19. time_since_update = 0
  20. # multi-camera
  21. location = (np.inf, np.inf)
  22. @property
  23. def end_frame(self):
  24. return self.frame_id
  25. @staticmethod
  26. def next_id():
  27. BaseTrack._count += 1
  28. return BaseTrack._count
  29. def activate(self, *args):
  30. raise NotImplementedError
  31. def predict(self):
  32. raise NotImplementedError
  33. def update(self, *args, **kwargs):
  34. raise NotImplementedError
  35. def mark_lost(self):
  36. self.state = TrackState.Lost
  37. def mark_removed(self):
  38. self.state = TrackState.Removed