hunto / LocalMamba

Code for paper LocalMamba: Visual State Space Model with Windowed Selective Scan
Apache License 2.0
204 stars 12 forks source link

The question about padding before scaning #17

Open ysugsl opened 7 months ago

ysugsl commented 7 months ago

I would like to know whether you calculate y through SSM after filling and partial scanning, and whether you remove the filling part obtained from y. If so, in which part of the code is it implemented?

hunto commented 7 months ago

We remove the filling part in MultiScan.reverse, inside the local_reverse function, the padded part will be removed. https://github.com/hunto/LocalMamba/blob/80979ca385ea21b87ead792701b1b9c328e618e7/classification/lib/models/mamba/multi_mamba.py#L21

We calculate SSM in MultiMamba for LocalVim and SelectiveScan for LocalVMamba.

https://github.com/hunto/LocalMamba/blob/80979ca385ea21b87ead792701b1b9c328e618e7/classification/lib/models/mamba/multi_mamba.py#L165

https://github.com/hunto/LocalMamba/blob/80979ca385ea21b87ead792701b1b9c328e618e7/classification/lib/models/local_vmamba.py#L70

If you have any remaining questions, please feel free to provide more details. Thank you!