# On-Edge Deployment of Vision Transformers for Medical Diagnostics Using the Kvasir-Capsule Dataset
## 5 Conclusions  
This work studied the use of quantized ViT models for on-edge medical diagnostics, specifically focusing on the Kvasir-Capsule image classification dataset. The quantization techniques were leveraged using the TFLite framework, utilizing the float-16 and QAT quantization techniques to reduce model size without compromising performance. In total, seven versions of ViT-based lightweight image classifiers were evaluated, namely, EfficientFormerV2S2, EfficientViT_B0, EfficientViT_M4, MobileViT_V2_050, MobileViT_V2_100, MobileViT_V2_175, and RepViT_M11. The evaluation was based on three metrics in particular, including the F1-score, the model size, and the performance-to-size ratio (dividing the F1-score by the size in MB). Our results indicated that MobileViT_V2_175 with F16 quantization achieved the highest F1-score of 0.9534, making it the best-performing model. In contrast, MobileViT_V2_050 with QAT was the smallest model at 1.70 MB and had the highest performance-to-size ratio of 41.25. Despite tending towards smaller models to address latency and memory concerns, medical diagnostic systems cannot compromise performance. Therefore, MobileViT_V2_175 with F16 quantization, with a size of 27.47 MB, is recommended for deployment on edge devices, providing an optimal balance between size and performance. This study sets a benchmark for lightweight models on the Kvasir-Capsule dataset and highlights the potential of quantized ViTs for medical image classification on edge devices. Future work will focus on further optimizing these models and creating standardized frameworks for deployment on specific on-edge devices such as mobile phones, as proposed in Appendix A. Despite the performance of MobileViT_V2_175, its size of 27.47 MB might cause challenges when deploying on edge devices with extremely limited memory and computational resources. In addition, F16 quantization may not be compatible with all types of edge devices and may require further fine-tuning to allow for deployment. We would also recommend researchers to expand the dataset (or others) to include more classes and samples to enhance the robustness of the models. Moreover, efforts will be made to improve the explainability and interpretability of these models to ensure their reliable application in clinical settings. Conceptualization, D.V., L.K. and T.S. ; methodology, D.V., L.K. and T.S. ; software, D.V. and L.K. ; validation, D.V., L.K. and T.S. ; formal analysis, D.V. and L.K. ; investigation, D.V. and L.K. ; resources, D.V., L.K. and T.S. ; data curation, D.V. and L.K. ; writing--original draft preparation, D.V. and L.K. ; writing--review and editing, D.V., L.K. and T.S. ; supervision, T.S. ; project administration, T.S. All authors have read and agreed to the published version of the manuscript. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Approach** & **Quantization** & **F1-Score** & **Model Size** \\ \hline EfficientNetV2B2 [25] & QAT & 0.9751 & 9.9 MB \\ MobileViT\_V2\_175 (ours) & QAT & 0.9798 & 14.7 MB \\ \hline \hline \end{tabular}
\end{table} 
Table 13: Comparison of best-performing models on the X-ray Lung Diseases dataset [26]. **Funding:** This research received no external funding. **Institutional Review Board Statement:** Not applicable. **Informed Consent Statement:** Not applicable. **Data Availability Statement:** Data used in this paper are publicly available and cited as relevant. The code used for generating results is available on GitHub through [[https://github.com/[PERSON]/Lightweight-ViTs-for-Medical-Diagnostics](https://github.com/[PERSON]/Lightweight-ViTs-for-Medical-Diagnostics)]([https://github.com/[PERSON]/Lightweight-ViTs-for-Medical-Diagnostics](https://github.com/[PERSON]/Lightweight-ViTs-for-Medical-Diagnostics)). The code used for developing the mobile application is available on Github through [[https://github.com/lujain-khalil/gastro_lens](https://github.com/lujain-khalil/gastro_lens)]([https://github.com/lujain-khalil/gastro_lens](https://github.com/lujain-khalil/gastro_lens)).