hkchengrex / Tracking-Anything-with-DEVA

[ICCV 2023] Tracking Anything with Decoupled Video Segmentation
https://hkchengrex.com/Tracking-Anything-with-DEVA/
Other
1.27k stars 129 forks source link

How to get subpart/part/whole-level segmentation like SAM? #86

Closed chenkangjie1123 closed 6 months ago

chenkangjie1123 commented 6 months ago

Hello, I would like to know: the original SAM model can output segmentation results at three levels: whole, part, and subpart. Does your method now support such output? Because I tried to modify the two parameters --suppress_small_objects --SAM_PRED_IOU_THRESHOLD and found that The result is only that there is a difference in the range of the segmented areas, but it seems that no difference in scales such as subpart, part, and whole is seen?

hkchengrex commented 6 months ago

You can modify the segment selection process of SAM in this class: https://github.com/hkchengrex/Tracking-Anything-with-DEVA/blob/752d2f5e65a7d5efdd55e55f48932678798ef3d8/deva/ext/SAM/automatic_mask_generator.py#L41

We do find these granularities to be temporally highly unstable.

chenkangjie1123 commented 6 months ago

Indeed, I have modified this part of the code and found that when deva performs mask matching on the whole scale, some frame images may completely lose the mask, while the subpart and part scale results are okay.

HuangWenH commented 1 month ago

@hkchengrex @chenkangjie1123 This is a great work. Could you tell me which parameters to adjust to achieve multi-scale cutting? I tried to modify the crop_n_layers parameter, but KeyError: 'crop_boxes error occurred. How can I adjust the parameters to achieve smaller scale cutting, such as cutting car tires and other details? image

hkchengrex commented 1 month ago

@HuangWenH I don't think there are explicit definitions of those granularities in SAM. It was just an observation. So we would have to extract/compare those scales manually with post-processing. This can be done within the SAMAutomaticMaskGenerator, more specifically here: https://github.com/hkchengrex/Tracking-Anything-with-DEVA/blob/752d2f5e65a7d5efdd55e55f48932678798ef3d8/deva/ext/SAM/automatic_mask_generator.py#L317-L329