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 class_name BUG? #54

Open
Li-jinnan opened this issue Sep 25, 2024 · 0 comments
Open

Object class_name BUG? #54

Li-jinnan opened this issue Sep 25, 2024 · 0 comments

Comments

@Li-jinnan
Copy link

I found that when executing ‘grounded_sam2_tracking_demo_with_continuous_id.py’, the resulting segmented image has an incorrect correspondence between id and class_name, but the mask file it produces is correct . After checking, I found that there is a problem with the functions in the ‘common_ultils.py’ file, and I need to make the following changes: Original code: sam2_tracking_demo_with_continuous_id.py
Original code:

Sort object IDs and boxes, but not class names

paired_id_and_box = zip(all_object_ids, all_object_boxes)
sorted_pair = sorted(paired_id_and_box, key=lambda pair: pair[0])

After sorting, reorder only IDs and boxes

all_object_ids = [pair[0] for pair in sorted_pair] all object identifiers
all_object_boxes = [pair[1] for pair in sorted_pair] all object boxes

Fixed code:

Sort object IDs, boxes and class names together for consistency

paired_id_and_box_and_class = zip(all_object_ids, all_object_boxes, all_class_names)
sorted_pair = sorted(paired_id_and_box_and_class, key=lambda pair: pair[0]) # Sort based on object IDs

After sorting, reorder IDs, boxes and class names together

all_object_ids = [pair[0] for pair in sorted_pair] all object IDs
all_object_boxes = [pair[1] for pair in sorted_pair] all object boxes
all_class_names = [pair[2] for pair in sorted_pair] all class names

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