DuoFormer: Leveraging Hierarchical Visual Representations by Local and Global Attention
This work addresses efficiency and generalizability issues in vision models for medical imaging, though it appears incremental as it builds on existing CNN and transformer methods.
The paper tackles the lack of inductive biases and data dependence in Vision Transformers by proposing a hierarchical transformer that integrates CNNs for feature extraction, achieving significant performance improvements on small and medium-sized medical datasets.
We here propose a novel hierarchical transformer model that adeptly integrates the feature extraction capabilities of Convolutional Neural Networks (CNNs) with the advanced representational potential of Vision Transformers (ViTs). Addressing the lack of inductive biases and dependence on extensive training datasets in ViTs, our model employs a CNN backbone to generate hierarchical visual representations. These representations are then adapted for transformer input through an innovative patch tokenization. We also introduce a 'scale attention' mechanism that captures cross-scale dependencies, complementing patch attention to enhance spatial understanding and preserve global perception. Our approach significantly outperforms baseline models on small and medium-sized medical datasets, demonstrating its efficiency and generalizability. The components are designed as plug-and-play for different CNN architectures and can be adapted for multiple applications. The code is available at https://github.com/xiaoyatang/DuoFormer.git.