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

Object ID for Tracking #6

Open
MarcMatute opened this issue Oct 16, 2024 · 0 comments
Open

Object ID for Tracking #6

MarcMatute opened this issue Oct 16, 2024 · 0 comments

Comments

@MarcMatute
Copy link

MarcMatute commented Oct 16, 2024

Hey there!

Firstly, thank you very much for your work! Probably it will be very useful.

For various reasons, I need to get the object ID for every object. I edited the code in such a way so that now I can see the object ID in the frame result. However, the way I did it seems like object IDs are not coherent frame after frame.

For example, here we have one object ID for a smoke object:

image

And the same object but with a different ID in the same video:

image

The changes I made are very little in the writing results part in detect.py:

`

             # Write results
            for idx, (*xyxy, conf, cls) in enumerate(reversed(det)):
            
                # Add the object_id to the label
                object_id = list(centroids.keys())[idx]
                c = int(cls)  # integer class
                label = None if hide_labels else (f'ID: {object_id} {names[c]}' if hide_conf else f'ID: {object_id} {names[c]} {conf:.2f}')
                
                annotator.box_label(xyxy, label, color=colors(c, True))
                
                if save_crop:
                    save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)

`

Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant