-
Notifications
You must be signed in to change notification settings - Fork 160
Feature: Offline Tracker (KSP Tracker) #89
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Ashp116, thanks for the PR!
I have mentioned some feedback regarding the accuracy of the implementation as per the paper and also regarding how the API for using a offline tracker should be like.
Hi @soumik12345, Thank you for reviewing the PR, and also thank you for your kind words. I’m really happy this will be merged soon. I have made the requested changes and also added documentation. Regarding the
Just curious — how in-depth should I go when explaining the implementation differences? Should I keep it high-level, or go into the full algorithm and cost differences compared to the paper? Also, should I explicitly mention this paper in the documentation when explaining the differences? Also, I was experimenting with the tracker docs UI style. I was wondering if the new tracker docs style (showcased in this video) might be something to consider changing? It fits well with the rest of the docs (e.g., Supervision, Inference, etc.). If such a change is appropriate, should I push it to this PR or create a separate one? Thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Ashp116, thanks for adding the documentations, they seem to be sufficient. However, I recommend that we also cite Tracklet Association Tracker and just mention that ideas from this paper served as inspiration for the modified edge cost function. As for an in-depth explanation, would you be open to writing a blog post on blog.roboflow.com on KSPTracker
?
As for the docs UI style, I think that is out of scope for this PR. Feel free to open an issue and we can discuss further, I am sure @capjamesg would love discuss this.
Overall, I the PR is shaping up great; I left some minor feedbacks.
|
||
[](https://doi.org/10.1109/TPAMI.2011.21) | ||
[](http://vision.stanford.edu/teaching/cs231b_spring1415/papers/Berclaz-tracking.pdf) | ||
[](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-objects-with-sort-tracker.ipynb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this colab link. Can you please raise a corresponding PR on roboflow/notebooks?
def track( | ||
self, | ||
source_path: str, | ||
get_model_detections: Callable[[np.ndarray], sv.Detections], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be a list of sv.Detections
, not a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not making track
call the model to inference the frame? When we send a video source path, it is assumed we will resolve for the model detections. With this in mind and the various ways to inference; a function is more versatile.
trackers/core/ksp/solver.py
Outdated
conf_u, conf_v = nodeU.confidence, nodeV.confidence | ||
|
||
center_dist = np.linalg.norm(self._get_center(bboxU) - self._get_center(bboxV)) | ||
iou_penalty = 1 - self._iou(bboxU, bboxV) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using custom IoU computation for KSPTracker
, if you can come up with a way to optimize box_iou_batch
, not only all the other trackers will benefit, but also the community will benefit in general 🙂
eac7fbc
to
8f1cc52
Compare
…116/trackers into feature/offline-tracker-ksp
Hi @soumik12345 , Thank you for reviewing my PR. I’ve applied all the requested changes except for two:
Major Improvement: Disjoint Paths in KSP I’ve made a significant improvement to how disjoint paths are handled in the K-Shortest Paths (KSP) algorithm. Previously, there were frequent tracker ID switches, especially when objects entered or exited the scene. To address this, I implemented the approach described in the paper:
Following this, I introduced support for entry/exit regions—including both custom-defined regions and automatic frame-border regions. These act like "doors" through which objects can enter or leave the scene, enabling the graph to represent disjoint paths more accurately. This change dramatically improves tracking stability. Tracker switches are now significantly reduced, and the disjoint paths are now handled at the graph-building stage, while I’ll attach videos showing the improvements. Also, I'd love to write a blog post explaining how this KSP tracker works, including the recent changes. What’s the best way to go about contributing a blog post? Here is the collab notebook Thanks again! VidoesExample: Look at the person labeled with tracker ID Old KSPdownload.mp4New KSPdownload.2.mp4 |
Description
This PR introduces a new offline Multiple Object Tracker (MOT) based on the K-Shortest Paths (KSP) optimization algorithm. This tracker is based on the method proposed in the paper: "Multiple Object Tracking using K-Shortest Paths Optimization" by Jérôme Berclaz et al. The tracker models detections across frames as a directed acyclic graph and solves for globally optimal object trajectories by computing disjoint shortest paths.
The inspiration for this PR: #59
List any dependencies that are required for this change.
Yes, this PR needs
networkx
to build a directed acyclic graph.Type of change
How has this change been tested? Please provide a testcase or example of how you tested the change?
This PR can be tested using the Colab notebook provided here. The notebook can be used to test KSP Tracker. Currently, the notebook is using one of the MOT17 Challenge Datasets, specifically MOT17-02-FRCNN.
Any specific deployment considerations
N/A
Docs