Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracker latest #256

Merged
merged 24 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a59e4df
updated tracker
dbroboflow Aug 1, 2023
aa50052
mot20 deleted
dbroboflow Aug 1, 2023
8eaa42a
lint fixed
dbroboflow Aug 1, 2023
f2d2827
lint fixed again
dbroboflow Aug 1, 2023
414e032
scipy added to pyproject.toml
dbroboflow Aug 1, 2023
2a9a1f0
scipy fixed
dbroboflow Aug 1, 2023
8f43710
scipy fixed
dbroboflow Aug 1, 2023
da9d50b
docs updated
dbroboflow Aug 1, 2023
514f61b
initial optimized working version
Aug 1, 2023
4942d3d
Merge pull request #260 from hardikdava/hot_fix/tracker
dbroboflow Aug 2, 2023
a45cc86
lint fixed
dbroboflow Aug 2, 2023
94f15a6
Merge branch 'develop' into tracker_latest
SkalskiP Aug 7, 2023
1c23e80
🧹 initial cleanup
SkalskiP Aug 7, 2023
330167f
🖤 make black happy
SkalskiP Aug 7, 2023
451bb5e
🧹 more cleanup
SkalskiP Aug 7, 2023
62e097b
🧹 more cleanup - dropping example scripts, plugging in ByteTrack docs…
SkalskiP Aug 7, 2023
ba88040
🧹 more cleanup - remove unused code
SkalskiP Aug 7, 2023
db2eede
🧹 more cleanup - remove more unused code, documentation improvements
SkalskiP Aug 7, 2023
bee6dec
🧹 more cleanup - solve `poetry.lock` and `pyproject.toml`
SkalskiP Aug 7, 2023
aa77c39
🧹 more cleanup - update docs, remove dead if branches
SkalskiP Aug 7, 2023
3834e5c
🧹 more cleanup - refactor of `joint_tracks`, `sub_tracks` and `remove…
SkalskiP Aug 7, 2023
6741ae6
🧹 more cleanup - remove more dead code + update docstring
SkalskiP Aug 7, 2023
de536a3
🖤 make black happy
SkalskiP Aug 7, 2023
b5e83fa
Merge pull request #271 from roboflow/tracker_cleanup
SkalskiP Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/tracker/core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## ByteTrack

:::supervision.tracker.byte_tracker.core.ByteTrack

2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ nav:
- Utils: detection/utils.md
- Tools:
- Polygon Zone: detection/tools/polygon_zone.md
- Trackers:
- Core: tracker/core.md
- Dataset:
- Core: dataset/core.md
- Metrics:
Expand Down
40 changes: 39 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pyyaml = "^6.0"
pillow = "^9.4.0"
opencv-python = { version = "^4.8.0.74", optional = true }
opencv-python-headless = "^4.8.0.74"
scipy = "^1.9.0"


[tool.poetry.extras]
Expand Down
1 change: 1 addition & 0 deletions supervision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from supervision.geometry.core import Point, Position, Rect
from supervision.geometry.utils import get_polygon_center
from supervision.metrics.detection import ConfusionMatrix, MeanAveragePrecision
from supervision.tracker.byte_tracker.core import ByteTrack
from supervision.utils.file import list_files_with_extensions
from supervision.utils.image import ImageSink, crop
from supervision.utils.notebook import plot_image, plot_images_grid
Expand Down
Empty file added supervision/tracker/__init__.py
Empty file.
Empty file.
55 changes: 55 additions & 0 deletions supervision/tracker/byte_tracker/basetrack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from collections import OrderedDict
from enum import Enum

import numpy as np


class TrackState(Enum):
New = 0
Tracked = 1
Lost = 2
Removed = 3


class BaseTrack:
_count = 0

def __init__(self):
self.track_id = 0
self.is_activated = False
self.state = TrackState.New

self.history = OrderedDict()
self.features = []
self.curr_feature = None
self.score = 0
self.start_frame = 0
self.frame_id = 0
self.time_since_update = 0

# multi-camera
self.location = (np.inf, np.inf)

@property
def end_frame(self) -> int:
return self.frame_id

@staticmethod
def next_id() -> int:
BaseTrack._count += 1
return BaseTrack._count

def activate(self, *args):
raise NotImplementedError

def predict(self):
raise NotImplementedError

def update(self, *args, **kwargs):
raise NotImplementedError

def mark_lost(self):
self.state = TrackState.Lost

def mark_removed(self):
self.state = TrackState.Removed
Loading