MSPE: Multi-Scale Patch Embedding Prompts Vision Transformers to Any Resolution

Although Vision Transformers (ViTs) have recently advanced computer vision tasks significantly, an important real-world problem was overlooked: adapting to variable input resolutions. Typically, images are resized to a fixed resolution, such as 224x224, for efficiency during training and inference. However, uniform input size conflicts with real-world scenarios where images naturally vary in resolution. Modifying the preset resolution of a model may severely degrade the performance. In this work, we propose to enhance the model adaptability to resolution variation by optimizing the patch embedding. The proposed method, called Multi-Scale Patch Embedding (MSPE), substitutes the standard patch embedding with multiple variable-sized patch kernels and selects the best parameters for different resolutions, eliminating the need to resize the original image. Our method does not require high-cost training or modifications to other parts, making it easy to apply to most ViT models. Experiments in image classification, segmentation, and detection tasks demonstrate the effectiveness of MSPE, yielding superior performance on low-resolution inputs and performing comparably on high-resolution inputs with existing methods.

Paper

References (52)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer 9L8r7/10 · confidence 4/52024-07-10

Summary

1. They analyze the resolution adaptability in ViT models, identify the patch embedding layer as the crucial component, and provide a low-cost solution. 2. They propose Multi-Scale Patch Embedding (MSPE), which enhances ViT models by substituting the standard patch embedding layer with learnable, adaptive convolution kernels, enabling ViTs to be applied on any input resolution. 3. Experiments demonstrate that with minimal training (only five epochs), MSPE significantly enhances performance across different resolutions on classification, segmentation, and detection tasks.

Strengths

1. They found two problems in the optimization target function in FlexiViT and they illustrate similarity in patch embeddings does not ensure the best performance. 2. MSPE allows ViTs to handle variable input resolutions directly, significantly improving performance on low-resolution inputs and maintaining high performance on high-resolution inputs. 3. MSPE is easy to apply to existing ViT models as it only modifies the patch embedding layer, avoiding the need for high-cost training or extensive model modifications. 4. MSPE significantly improves performance across different visual tasks, including image classification, segmentation, and detection, especially in comparison to previous methods like FlexiViT and ResFormer.

Weaknesses

1. This method assumes that the input x follows a normal distribution x∼N(0,1) for finding the optimal solution in downscaling scenarios. However, this assumption may not hold true for all input images, particularly in real-world scenarios where image data often does not follow a normal distribution. 2. Equation (3) isolates the optimization to gθ, but a more holistic approach that includes Encϕ could potentially lead to better alignment of the entire model's parameters, ensuring more coherent and efficient learning across different resolutions.

Questions

It's impressive that MSPE achieves much better results with low-resolution images. Is it possible to also show the performance with higher image resolutions larger than 1000?

Rating

7

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

No

Reviewer gLBy5/10 · confidence 4/52024-07-12

Summary

The paper introduces Multi-Scale Patch Embedding (MSPE), a novel approach to enhance Vision Transformers (ViTs) by allowing them to adapt to variable input resolutions without resizing images to a fixed resolution. MSPE uses multiple variable-sized patch kernels and selects the optimal parameters for different resolutions, maintaining performance across tasks likes image classification, segmentation, and detection.

Strengths

1. MSPE replaces the standard patch embedding layer in Vision Transformers (ViTs) with multiple learnable adaptive convolution kernels, enabling the effective handling of different input resolutions. 2. MSPE demonstrates improved performance across varying resolutions in classification, segmentation, and detection tasks with minimal additional training.

Weaknesses

1. This paper does not experiment with other more effective positional encoding strategies. The paper mentions that linear interpolation of positional embedding has achieved acceptable performance in existing work. 2. The paper analyses the importance of patch embedding but lacks corresponding experimental evidence comparing its importance to other components like encoder and positional encoding. Additionally, the components may show different impacts for different tasks; it does not analyze how the importance of these components may vary across different tasks. 3. The training efficiency of MSPE is highlighted, yet the potential long-term benefits of additional training epochs are not fully explored. It would be beneficial to see more detailed comparisons over extended training periods to understand better the model’s convergence behavior and potential overfitting issues. 4. Minor Error: In 2.1 Vision Transformer Models, the shape of image `x` is defined as `h*w*c`, but the kernel shape obtained is `h_k * w_k * d`. Shouldn't the kernel shape be `h_k * w_k * c * d`?

Questions

1. Is selecting the hyperparameter λ during the training process crucial for the model's performance? Can different values of λ yield good results? 2. Can you elaborate on the differences between MSPE with FlexiViT? 3. Is there a rationale behind selecting the hyperparameter K and its corresponding shape in MSPE, or was it arbitrarily chosen? 4. Did the authors attempt to apply the model to uncommon resolutions (e.g., 200x150) to test its generalization performance?

Rating

5

Confidence

4

Soundness

2

Presentation

2

Contribution

2

Limitations

NA

Reviewer gLBy2024-08-13

The response has resolved my concerns, and I have raised the score.

Reviewer RdsV7/10 · confidence 4/52024-07-13

Summary

This paper proposes to substitute the standard patch embedding with multiple variable-sized patch kernels. This eliminates the need to resize the original image. Extensive experiment results are shown to demonstrate the benefits.

Strengths

The problem is well defined and the proposed method is sound. Convincing results are shown to support the claims.

Weaknesses

NA

Questions

The highest resolution shown is 448, 2x the training resolution 224. A typical cell phone camera has a resolution around 2K. Could the proposed method bridge this 10x gap?

Rating

7

Confidence

4

Soundness

4

Presentation

4

Contribution

4

Limitations

yes

Reviewer tsgU6/10 · confidence 4/52024-07-15

Summary

The paper aim to address the challenge of adapting ViTs to variable input resolutions, which is a critical issue often overlooked in real-world applications. The authors propose a new method named Multi-Scale Patch Embedding (MSPE), which enhances the patch embedding layer by incorporating multiple variable-sized patch kernels. This approach allows the model to process images of varying resolutions without resizing, thus maintaining performance across different resolutions.

Strengths

1. Problem Identification: This paper clearly identifies the gap in current ViT models, i.e. they are unable to handle variable input resolutions effectively. This is a crucial problem as real-world images often come in various resolutions. 2. Sound Approach: The proposed MSPE substitutes the standard patch embedding layer with learnable adaptive convolution kernels, which allows the model to adjust to different input resolutions dynamically. 3. Theoretical Analysis: The paper offers a thorough theoretical analysis of the problem and the proposed solution. This includes a detailed discussion on the patch embedding layer's role and the limitations of existing methods like FlexiViT and ResFormer. 4. Comprehensive Experiments: The authors provide extensive experimental results demonstrating the effectiveness of MSPE across various tasks, including image classification, segmentation, and detection.

Weaknesses

1. Technical Contribution: Although the proposed method improves the multi-resolution performance of ViTs, it essentially solves an engineering problem from an engineering perspective. 2. Scalability Concerns: Although the method is low-cost and compatible with existing ViT models, the paper does not fully address potential scalability issues when applied to very large datasets or extremely high-resolution images. 3. Ablation Studies: The paper could benefit from more detailed ablation studies to isolate the contributions of different components of the MSPE and better understand the impact of each design choice. 4. Real-World Applications: While the experiments are comprehensive, the paper could include more real-world application scenarios to demonstrate the practical benefits and robustness of MSPE in diverse settings.

Questions

See Weakness.

Rating

6

Confidence

4

Soundness

3

Presentation

3

Contribution

2

Limitations

The authors addressed the limitation in the paper.

Reviewer 9L8r2024-08-07

Thank you for clarifying the weaknesses. Your explanation has resolved my concerns. I'm glad to see the tremendous performance on the higher resolution images. I maintain my score as accepted.

Area Chair bqCf2024-08-12

Reviewer-author discussion period

Dear reviewers, The authors have responded according to your comments. Please have a check to see whether your concerns are adequately solved. You can ask authors to address further if required. Best, Your AC

Reviewer RdsV2024-08-12

Thanks for adding new results. I assume these are up sampled images and hence little change in accuracy. If so, please make it clear in the final version.

Reviewer tsgU2024-08-13

The rebuttal addresses most of my concerns. I would raise my score.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC