-
Notifications
You must be signed in to change notification settings - Fork 563
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
Adding DeepSort object tracking utility #4296
Conversation
WalkthroughThe update introduces a new tracking utility for video datasets, leveraging the DeepSort algorithm. This enhancement involves the creation of a Changes
Poem
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Warning Following problems were encountered
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
This is awesome @rohis06 !!! I love the simplicity of your implementation, and this is a huge upgrade for FiftyOne 💪. The way you laid the structure out to accommodate others trackers in the future is perfect. The implementation works for me!!! Just one very minor question/note: the tracks have index numbers that are pretty high — it looks like a lot of the tracks got cut and the index is never reset. This means that the cars have labels like "car 14", "car 18", ... as opposed to "car 0", "car 1", ... etc. Is this the convention, if not, it might be nice to parse through the index numbers and reassign numbers starting from 0. What do you think? Also, I LOVE the illustration of trajectories. Thank you for making this by far more useful than ever before!! |
Thanks for reviewing and providing your feedback, @jacobmarks! 😄
That's actually correct since the DeepSort algorithm outputs the global tracking IDs. So, "car 14" doesn't essentially translate to the 14th car. Instead, it's the 14th object detected and tracked across all the frames of the input video. Even I felt it to be a little misleading. So, do you think it would be better to update the code so that the I can update the lines 112-119 to: tracked_detections.append(
fo.Detection(
bounding_box=[rel_x, rel_y, rel_w, rel_h],
index=track.track_id,
)
) Let me know what you think about this approach. |
Hmm I see. I think the best thing to do would be to add an argument to the tracker like |
@rohis06 I'm also seeing some small issues with bounding boxes/tracks.
|
Yeah, this sounds like a great approach. I will update the code to include the |
Hmm, I see. Could you please share the code snippet that resulted in this issue? I will try to reproduce it at my end and debug it further. |
Thanks for looking into this! I just used this code snippet: import fiftyone as fo
import fiftyone.zoo as foz
import fiftyone.brain as fob
from fiftyone import ViewField as F
from fiftyone.utils.tracking import DeepSort
dataset = foz.load_zoo_dataset("quickstart-video", max_samples=3)
model = foz.load_zoo_model("yolov8n-coco-torch")
dataset.ensure_frames()
dataset.apply_model(model, label_field="frames.yolo_detection")
DeepSort.track(dataset=dataset, in_field="frames.yolo_detection", max_age=15, progress=True) |
So, according to the official implementation of the deep sort algorithm, tracks have three states: Tentative, Confirmed, and Deleted. If we look at line 102 in our code, we can see that we ignore the tracks that aren't "confirmed" yet, which means not enough evidence has been collected for these tracks yet. In this specific dataset that we are testing, it looks like only when the 3rd frame is seen the tracks change their state from "tentative" to "confirmed". However, it doesn't always have to be the 3rd frame.
Thanks for pointing this out, @jacobmarks. I have addressed this issue. |
Awesome job @rohis06 , just ran the latest and it works swimmingly :) Massive kudos 🚀 |
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.
👍 LGTM!!!
Thanks so much! Glad to hear it's working well! 🚀 |
What changes are proposed in this pull request?
Adds DeepSort object tracking utility to FiftyOne 🎊
It can be used as follows:
How is this patch tested? If it is not, please explain why.
It has been thoroughly tested using the above code snippet.
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
Adds DeepSort object tracking utility to FiftyOne.
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
DeepSort
class, utilizing advanced deep learning techniques for improved accuracy and efficiency.