Vision Transformers (ViTs) and their variants have become state-of-the-art in many computer vision tasks. While substantial research has focused on architectural improvements, the impact of patch size, a crucial design choice in ViTs, remains underexplored, particularly in medical domains where both two-dimensional (2D) and three-dimensional (3D) imaging modalities exist. In this study, using 12 medical imaging datasets from various imaging modalities (including seven 2D and five 3D datasets), we conduct a thorough evaluation of how different patch sizes affect ViT classification performance. Using a single graphical processing unit (GPU) and a range of patch sizes (1, 2, 4, 7, 14, 28), we fine-tune ViT models and observe consistent improvements in classification performance with smaller patch sizes (1, 2, and 4), which achieve the best results across nearly all datasets. More specifically, our results indicate improvements in balanced accuracy of up to 12.78 percentage points for 2D datasets (patch size 2 vs. 28) and up to 23.78 percentage points for 3D datasets (patch size 1 vs. 14), at the cost of increased computational expense. Moreover, by combining the models trained with patch sizes 1, 2, and 4 using four fusion strategies, we achieve further performance gains in most cases, particularly for the 2D datasets. We further investigate the generalizability of these findings across higher image resolutions, different transformer architectures, and varying amounts of training data, observing performance trends similar to those of the main experiments. Our full implementation, along with guidelines for running the code, is publicly available on GitHub:https://github.com/HealMaDe/MedViT.
翻译:暂无翻译