Fine-Tuned Segment Anything Model with Low-Rank Adaptation for Chest X-Ray Images
Abstract
1. Introduction
- 1.
- We benchmark zero-shot SAM segmentation using coordinate and bounding box prompts derived from CNN-generated masks.
- 2.
- We propose a fine-tuning strategy for SAM using LoRA, tailored to the chest X-ray segmentation task.
- 3.
- We evaluate the performance of all models on curated CXR datasets, demonstrating that LoRA-tuned SAM outperforms both zero-shot methods and CNN baselines under constrained settings.
2. Background
3. Dataset
4. Method
4.1. Convolutional Neural Networks
4.2. Zero-Shot SAM with Coordinate Prompting
4.3. Pre-Trained SAM with Bounding Box Prompting
4.4. Fine-Tuned SAM Using LoRA
5. Results and Discussion
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Abbreviations
| CXR | Chest X-ray |
| LoRA | Low-rank adaptation |
| CNN | Convolutional neural network |
| SAM | Segment anything model |
References
- Irmici, G.; Cè, M.; Caloro, E.; Khenkina, N.; Della Pepa, G.; Ascenti, V.; Martinenghi, C.; Papa, S.; Oliva, G.; Cellina, M. Chest x-ray in emergency radiology: What artificial intelligence applications are available? Diagnostics 2023, 13, 216. [Google Scholar] [CrossRef] [Scilit]
- Elbarougy, R.; Aboghrara, E.; Behery, G.; Younes, Y.; El-Badry, N.M. COVID-19 detection on chest x-ray images by combining histogram-oriented gradient and convolutional neural network features. Inf. Sci. Lett. 2023, 12, 2247–2260. [Google Scholar]
- Ma, J.; Yang, Z.; Kim, S.; Chen, B.; Baharoon, M.; Fallahpour, A.; Asakereh, R.; Lyu, H.; Wang, B. Medsam2: Segment anything in 3d medical images and videos. arXiv 2025, arXiv:2504.03600. [Google Scholar] [CrossRef] [Scilit]
- Sahoo, P.; Sharma, S.K.; Saha, S.; Jain, D.; Mondal, S. A multistage framework for respiratory disease detection and assessing severity in chest X-ray images. Sci. Rep. 2024, 14, 12380. [Google Scholar] [CrossRef] [Scilit]
- Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Proceedings of the International Conference on Medical Image Computing and Computer-Assisted Intervention, Munich, Germany, 5–9 October 2015; Springer: Cham, Switzerland, 2015; pp. 234–241. [Google Scholar]
- Chen, L.C.; Zhu, Y.; Papandreou, G.; Schroff, F.; Adam, H. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 801–818. [Google Scholar]
- Paschali, M.; Chen, Z.; Blankemeier, L.; Varma, M.; Youssef, A.; Bluethgen, C.; Langlotz, C.; Gatidis, S.; Chaudhari, A. Foundation models in radiology: What, how, why, and why not. Radiology 2025, 314, e240597. [Google Scholar] [CrossRef] [Scilit]
- Azad, B.; Azad, R.; Eskandari, S.; Bozorgpour, A.; Kazerouni, A.; Rekik, I.; Merhof, D. Foundational models in medical imaging: A comprehensive survey and future vision. arXiv 2023, arXiv:2310.18689. [Google Scholar] [CrossRef] [Scilit]
- Kirillov, A.; Mintun, E.; Ravi, N.; Mao, H.; Rolland, C.; Gustafson, L.; Xiao, T.; Whitehead, S.; Berg, A.C.; Lo, W.Y.; et al. Segment anything. In Proceedings of the IEEE/CVF International Conference on Computer Vision 2023, Paris, France, 2–6 October 2023; pp. 4015–4026. [Google Scholar]
- Zhang, D.; Feng, T.; Xue, L.; Wang, Y.; Dong, Y.; Tang, J. Parameter-efficient fine-tuning for foundation models. arXiv 2025, arXiv:2501.13787. [Google Scholar]
- Hu, E.J.; Shen, Y.; Wallis, P.; Allen-Zhu, Z.; Li, Y.; Wang, S.; Wang, L.; Chen, W. Lora: Low-rank adaptation of large language models. In Proceedings of the 2022 International Conference on Learning Representations (ICLR 2022), Virtual, 25–29 April 2022; Volume 1, p. 3. [Google Scholar]
- Rajaraman, S.; Yang, F.; Zamzmi, G.; Xue, Z.; Antani, S. Can deep adult lung segmentation models generalize to the pediatric population? Expert Syst. Appl. 2023, 229, 120531. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Iqbal, A.; Usman, M.; Ahmed, Z. Tuberculosis chest X-ray detection using CNN-based hybrid segmentation and classification approach. Biomed. Signal Process. Control 2023, 84, 104667. [Google Scholar] [CrossRef] [Scilit]
- Arvind, S.; Tembhurne, J.V.; Diwan, T.; Sahare, P. Improvised light weight deep CNN based U-Net for the semantic segmentation of lungs from chest X-rays. Results Eng. 2023, 17, 100929. [Google Scholar] [CrossRef] [Scilit]
- Goodfellow, I.J.; Pouget-Abadie, J.; Mirza, M.; Xu, B.; Warde-Farley, D.; Ozair, S.; Courville, A.; Bengio, Y. Generative adversarial nets. In Proceedings of the 28th International Conference on Neural Information Processing Systems, Montreal, QC, Canada, 8–13 December 2014. [Google Scholar]
- Gaál, G.; Maga, B.; Lukács, A. Attention u-net based adversarial architectures for chest X-ray lung segmentation. arXiv 2020, arXiv:2003.10304. [Google Scholar]
- Din, S.; Shoaib, M.; Serpedin, E. CXR-Seg: A Novel Deep Learning Network for Lung Segmentation from Chest X-ray Images. Bioengineering 2025, 12, 167. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Turk, F.; Kılıçaslan, M. Lung image segmentation with improved U-Net, V-Net and Seg-Net techniques. PeerJ Comput. Sci. 2025, 11, e2700. [Google Scholar] [PubMed]
- Hasan, D.; Abdulazeez, A.M. Lung segmentation from chest X-ray images using deeplabv3plus-based cnn model. Indones. J. Comput. Sci. 2024, 13, 13–24. [Google Scholar] [CrossRef] [Scilit]
- Abedalla, A.; Abdullah, M.; Al-Ayyoub, M.; Benkhelifa, E. Chest X-ray pneumothorax segmentation using U-Net with EfficientNet and ResNet architectures. PeerJ Comput. Sci. 2021, 7, e607. [Google Scholar] [PubMed]
- Rahman, T.; Khandakar, A.; Kadir, M.A.; Islam, K.R.; Islam, K.F.; Mazhar, R.; Hamid, T.; Islam, M.T.; Kashem, S.; Mahbub, Z.B.; et al. Reliable tuberculosis detection using chest X-ray with deep learning, segmentation and visualization. IEEE Access 2020, 8, 191586–191601. [Google Scholar] [CrossRef] [Scilit]
- Liu, W.; Luo, J.; Yang, Y.; Wang, W.; Deng, J.; Yu, L. Automatic lung segmentation in chest X-ray images using improved U-Net. Sci. Rep. 2022, 12, 8649. [Google Scholar] [CrossRef] [Scilit]
- Shiraishi, J.; Katsuragawa, S.; Ikezoe, J.; Matsumoto, T.; Kobayashi, T.; Komatsu, K.i.; Matsui, M.; Fujita, H.; Kodera, Y.; Doi, K. Development of a digital image database for chest radiographs with and without a lung nodule: Receiver operating characteristic analysis of radiologists’ detection of pulmonary nodules. Am. J. Roentgenol. 2000, 174, 71–74. [Google Scholar] [CrossRef] [Scilit]
- Candemir, S.; Jaeger, S.; Palaniappan, K.; Musco, J.P.; Singh, R.K.; Xue, Z.; Karargyris, A.; Antani, S.; Thoma, G.; McDonald, C.J. Lung segmentation in chest radiographs using anatomical atlases with nonrigid registration. IEEE Trans. Med. Imaging 2013, 33, 577–590. [Google Scholar] [CrossRef] [Scilit]
- Ghali, R.; Akhloufi, M.A. Vision transformers for lung segmentation on CXR images. SN Comput. Sci. 2023, 4, 414. [Google Scholar] [CrossRef] [Scilit]
- Ghali, R.; Akhloufi, M.A. Arseg: An attention regseg architecture for cxr lung segmentation. In Proceedings of the 2022 IEEE 23rd International Conference on Information Reuse and Integration for Data Science (IRI), San Diego, CA, USA, 9–11 August 2022; pp. 291–296. [Google Scholar]
- Chen, J.; Lu, Y.; Yu, Q.; Luo, X.; Adeli, E.; Wang, Y.; Lu, L.; Yuille, A.L.; Zhou, Y. Transunet: Transformers make strong encoders for medical image segmentation. arXiv 2021, arXiv:2102.04306. [Google Scholar] [CrossRef] [Scilit]
- Valanarasu, J.M.J.; Oza, P.; Hacihaliloglu, I.; Patel, V.M. Medical transformer: Gated axial-attention for medical image segmentation. In Proceedings of the International Conference on Medical Image Computing and Computer-Assisted Intervention, Strasbourg, France, 27 September–1 October 2021; Springer: Cham, Switzerland, 2021; pp. 36–46. [Google Scholar]
- Valanarasu, J.M.J.; Patel, V.M. Unext: Mlp-based rapid medical image segmentation network. In Proceedings of the International Conference on Medical Image Computing and Computer-Assisted Intervention, Singapore, 18–22 September 2022; Springer: Cham, Switzerland, 2022; pp. 23–33. [Google Scholar]
- Jaeger, S.; Candemir, S.; Antani, S.; Wáng, Y.X.J.; Lu, P.X.; Thoma, G. Two public chest X-ray datasets for computer-aided screening of pulmonary diseases. Quant. Imaging Med. Surg. 2014, 4, 475. [Google Scholar] [PubMed]
- Teixeira, L.O.; Pereira, R.M.; Bertolini, D.; Oliveira, L.S.; Nanni, L.; Cavalcanti, G.D.; Costa, Y.M. Impact of lung segmentation on the diagnosis and explanation of COVID-19 in chest X-ray images. Sensors 2021, 21, 7116. [Google Scholar] [CrossRef] [Scilit]
- Souza, J.C.; Diniz, J.O.B.; Ferreira, J.L.; Da Silva, G.L.F.; Silva, A.C.; De Paiva, A.C. An automatic method for lung segmentation and reconstruction in chest X-ray using deep neural networks. Comput. Methods Programs Biomed. 2019, 177, 285–296. [Google Scholar] [CrossRef] [Scilit]
- Chowdhury, M.E.; Rahman, T.; Khandakar, A.; Mazhar, R.; Kadir, M.A.; Mahbub, Z.B.; Islam, K.R.; Khan, M.S.; Iqbal, A.; Al Emadi, N.; et al. Can AI help in screening viral and COVID-19 pneumonia? IEEE Access 2020, 8, 132665–132676. [Google Scholar] [CrossRef] [Scilit]
- Rahman, T.; Khandakar, A.; Qiblawey, Y.; Tahir, A.; Kiranyaz, S.; Kashem, S.B.A.; Islam, M.T.; Al Maadeed, S.; Zughaier, S.M.; Khan, M.S.; et al. Exploring the effect of image enhancement techniques on COVID-19 detection using chest X-ray images. Comput. Biol. Med. 2021, 132, 104319. [Google Scholar] [CrossRef] [Scilit]
- Chen, L.C.; Papandreou, G.; Schroff, F.; Adam, H. Rethinking atrous convolution for semantic image segmentation. arXiv 2017, arXiv:1706.05587. [Google Scholar] [CrossRef] [Scilit]








| Image Class | Number of Images | Source |
|---|---|---|
| COVID-19 | 552 | KKH |
| Normal | 511 | KKH |
| Viral Pneumonia | 549 | Chowdhury [33] |
| Number of Coordinates | Accuracy % | IoU | Dice Coefficient | Precision | Recall | F1 Score |
|---|---|---|---|---|---|---|
| 15 | 56.2 | 0.409 | 0.571 | 0.441 | 0.856 | 0.571 |
| 30 | 57.1 | 0.414 | 0.575 | 0.443 | 0.859 | 0.575 |
| 45 | 58.2 | 0.427 | 0.587 | 0.452 | 0.879 | 0.587 |
| 60 | 59.6 | 0.439 | 0.599 | 0.463 | 0.891 | 0.599 |
| 75 | 60.3 | 0.445 | 0.605 | 0.469 | 0.899 | 0.605 |
| 90 | 60.6 | 0.450 | 0.610 | 0.473 | 0.908 | 0.610 |
| 105 | 60.3 | 0.451 | 0.611 | 0.474 | 0.916 | 0.611 |
| Number of Coordinates | Accuracy % | IoU | Dice Coef | Precision | Recall | F1 Score |
|---|---|---|---|---|---|---|
| U-Net [5] | 57.6 | 0.313 | 0.470 | 0.427 | 0.576 | 0.470 |
| DeepLabv3+ [35] | 95.1 | 0.862 | 0.925 | 0.928 | 0.926 | 0.925 |
| SAM zero-shot bounding box | 76.2 | 0.569 | 0.718 | 0.594 | 0.933 | 0.718 |
| SAM zero-shot (90 coord) | 60.6 | 0.450 | 0.610 | 0.473 | 0.908 | 0.610 |
| Fine-tuned SAM + LoRA | 95.8 | 0.882 | 0.937 | 0.955 | 0.922 | 0.937 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Alahmari, S.S.; Gardner, M.R.; Alqahtani, F.; Salem, T. Fine-Tuned Segment Anything Model with Low-Rank Adaptation for Chest X-Ray Images. Diagnostics 2026, 16, 847. https://doi.org/10.3390/diagnostics16060847
Alahmari SS, Gardner MR, Alqahtani F, Salem T. Fine-Tuned Segment Anything Model with Low-Rank Adaptation for Chest X-Ray Images. Diagnostics. 2026; 16(6):847. https://doi.org/10.3390/diagnostics16060847
Chicago/Turabian StyleAlahmari, Saeed S., Michael R. Gardner, Fawaz Alqahtani, and Tawfiq Salem. 2026. "Fine-Tuned Segment Anything Model with Low-Rank Adaptation for Chest X-Ray Images" Diagnostics 16, no. 6: 847. https://doi.org/10.3390/diagnostics16060847
APA StyleAlahmari, S. S., Gardner, M. R., Alqahtani, F., & Salem, T. (2026). Fine-Tuned Segment Anything Model with Low-Rank Adaptation for Chest X-Ray Images. Diagnostics, 16(6), 847. https://doi.org/10.3390/diagnostics16060847

