z-x-yang / Segment-and-Track-Anything

An open-source project dedicated to tracking and segmenting any objects in videos, either automatically or interactively. The primary algorithms utilized include the Segment Anything Model (SAM) for key-frame segmentation and Associating Objects with Transformers (AOT) for efficient tracking and propagation purposes.
GNU Affero General Public License v3.0
2.77k stars 335 forks source link

Unable to increase max_obj_num pass 255 #58

Closed Davidyao99 closed 1 year ago

Davidyao99 commented 1 year ago

I am trying to increase the number of items tracked by SegTracker. However, even after changing the segtracker_args['max_obj_num'] parameter to > 255, it still seems to be capped at 255. Any idea how to resolve this? Thanks!

ttancn commented 1 year ago

I am trying to increase the number of items tracked by SegTracker. However, even after changing the segtracker_args['max_obj_num'] parameter to > 255, it still seems to be capped at 255. Any idea how to resolve this? Thanks!

I also find this problem. Have you solved it?

Davidyao99 commented 1 year ago

Yes, the issue is that somewhere towards the end, the mask is converted to dtype uint8. Which means values can only be 0-255. This is to ensure the visualisation works properly. I think what I did was convert it to normal int so that mask values can be >255 and converted the mask values with mod 255 for the visualisation to still work.