We lifted 6 functions out of this paper's own repositories and ran 3 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| ofsoundof/LocalViT | canonical | 3 of 6 |
| Function | Status | Where it lives |
|---|---|---|
| flops_to_string | Ran | ofsoundof/LocalViT/flops_counter.py code served (permissive licence) · get_code("ad708b63b59159a6") |
| window_partition | Ran | ofsoundof/LocalViT/models/swin_transformer.py code served (permissive licence) · get_code("f9fd6241d935f07b") |
| window_reverse | Ran | ofsoundof/LocalViT/models/swin_transformer.py code served (permissive licence) · get_code("fb32094c6dbece71") |
| build_dataset | Not yet run | ofsoundof/LocalViT/datasets.py code served (permissive licence) · get_code("9153241c4331eb1a") |
| build_transform | Not yet run | ofsoundof/LocalViT/datasets.py code served (permissive licence) · get_code("3bc74137ab36aa79") |
| params_to_string | Not yet run | ofsoundof/LocalViT/flops_counter.py code served (permissive licence) · get_code("ddea91f7dddc66e6") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
The aim of this paper is to study the influence of locality mechanisms in vision transformers. Transformers originated from machine translation and are particularly good at modelling long-range dependencies within a long sequence. Although the global interaction between the token embeddings could be well modelled by the self-attention mechanism of transformers, what is lacking is a locality mechanism for information exchange within a local region. In this paper, locality mechanism is systematically investigated by carefully designed controlled experiments. We add locality to vision transformers into the feed-forward network. This seemingly simple solution is inspired by the comparison between feed-forward networks and inverted residual blocks. The importance of locality mechanisms is validated in two ways: 1) A wide range of design choices (activation function, layer placement, expansion ratio) are available for incorporating locality mechanisms and proper choices can lead to a performance gain over the baseline, and 2) The same locality mechanism is successfully applied to vision transformers with different architecture designs, which shows the generalization of the locality concept. For ImageNet2012 classification, the locality-enhanced transformers outperform the baselines Swin-T, DeiT-T, and PVT-T by 1.0%, 2.6% and 3.1% with a negligible increase in the number of parameters and computational effort. Code is available at https://github.com/ofsoundof/LocalViT.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2104.05707")
get_code_for_paper("2104.05707")
have("2104.05707")
Connect an agent — have() is free.