THU-MIG / RepViT

RepViT: Revisiting Mobile CNN From ViT Perspective [CVPR 2024] and RepViT-SAM: Towards Real-Time Segmenting Anything
https://arxiv.org/abs/2307.09283
Apache License 2.0
681 stars 55 forks source link

How to understand the multimask_output #24

Closed liuweixue001 closed 7 months ago

liuweixue001 commented 7 months ago

Hello,

How should I interpret the code snippet? If multimask_output is True, it selects the content starting from the second element onward. If False, it chooses only the first element. Can you provide insights or explanations for this conditional slicing operation? if multimask_output: mask_slice = slice(1, None) else: mask_slice = slice(0, 1) masks = masks[:, mask_slice, :, :]

thank you

jameslahm commented 7 months ago

Thanks for your interest. The first mask is for the single mask output. The subsequent masks are for disambiguating. Please refer to https://github.com/facebookresearch/segment-anything/blob/6fdee8f2727f4506cfbbe553e23b895e27956588/segment_anything/modeling/mask_decoder.py#L50