Classification of Pneumonia Using CNN and Vision Transformer

Authors

  • Ma`dan Shomsomi Universitas Amikom Purwokerto
  • Widhaksa Triawan Universitas Amikom Purwokerto
  • Purwadi Universitas Amikom Purwokerto

DOI:

https://doi.org/10.59934/jaiea.v5i2.1906

Keywords:

Deep Learning, MobileNetV2, Pneumonia, Vision Transformer, X-Ray Imaging

Abstract

Pneumonia remains one of the leading causes of mortality among children worldwide. This study aims to evaluate the performance of two deep learning architectures, Convolutional Neural Network (CNN) and Vision Transformer (ViT), for pneumonia classification using chest X-ray images. Four training scenarios were examined, consisting of MobileNetV2 baseline, MobileNetV2 fine-tuned, ViT baseline, and ViT fine-tuned models. The dataset was obtained from the Chest X-Ray Images (Pneumonia) collection and was processed through augmentation and preprocessing to produce a balanced set of 9,000 images. Baseline models were trained using a feature extraction approach, while fine-tuning was conducted by selectively unfreezing internal layers. Experimental results show that all models achieved accuracy above 95%. The MobileNetV2 baseline reached 97.63%, while its fine-tuned counterpart did not yield further improvement, achieving 97.41%. In contrast, the Vision Transformer demonstrated substantial performance gains, where partial fine-tuning produced the highest accuracy of 98.59% with an f1-score of 0.99. These findings indicate that ViT with targeted fine-tuning is more effective in capturing global representations within X-ray images, making it a strong candidate for computer-aided pneumonia detection systems supported by artificial intelligence.

Downloads

Download data is not yet available.

References

R. G. Bender et al., “Global, regional, and national incidence and mortality burden of non-COVID-19 lower respiratory infections and aetiologies, 1990–2021: a systematic analysis from the Global Burden of Disease Study 2021,” 2024. doi: 10.1016/S1473-3099(24)00176-2.

K. K. (Kemenkes), “Pneumonia Terus Ancam Anak-anak,” 2024. [Online]. Available: https://kemkes.go.id/id/pneumonia-terus-ancam-anak-anak

U. N. C. F. (UNICEF), “A child dies of pneumonia every 43 seconds.” [Online]. Available: https://data.unicef.org/topic/child-health/pneumonia/

P. Rosyani, S. Saprudin, and R. Amalia, “Klasifikasi Citra Menggunakan Metode Random Forest dan Sequential Minimal Optimization (SMO),” J. Sist. dan Teknol. Inf., vol. 9, no. 2, p. 132, 2021, doi: 10.26418/justin.v9i2.44120.

R. A. Saputra, D. R. R. Putra, and M. A. Asyrofi, “Implementasi Convolutional Neural Network (CNN) Untuk Mendeteksi Penggunaan Masker Pada Gambar,” J. Inform. dan Tek. Elektro Terap., vol. 11, no. 3, pp. 710–714, 2023, doi: 10.23960/jitet.v11i3.3286.

H. F. Fadhilah and R. Kurniawan, “Keunggulan dan Tantangan dalam Penggunaan Computer Vision untuk Diagnosis Pneumonia Pediatri: A Systematic Review,” J. Biostat. Kependudukan, dan Inform. Kesehat., vol. 5, no. 1, 2024, doi: 10.7454/bikfokes.v5i1.1077.

S. Arnandito and T. B. Sasongko, “Comparison of EfficientNetB7 and MobileNetV2 in Herbal Plant Species Classification Using Convolutional Neural Networks,” J. Appl. Informatics Comput., vol. 8, no. 1, pp. 176–185, 2024, doi: 10.30871/jaic.v8i1.7927.

O. F. Altal et al., “Hybrid attention-enhanced MobileNetV2 with particle swarm optimization for endometrial cancer classification in CT images,” Informatics Med. Unlocked, vol. 57, no. February, p. 101662, 2025, doi: 10.1016/j.imu.2025.101662.

S. Agustiani, R. Aryanti, S. Khotimatul Wildah, Y. T. Arifin, S. Marlina, and T. Misriati, “Optimisasi Model Deep Learning untuk Deteksi Penyakit Daun Tebu dengan Fine-Tuning MobileNetV2,” J. Informatics Manag. Inf. Technol., vol. 4, no. 4, pp. 150–157, 2024, doi: 10.47065/jimat.v4i4.411.

A. Syakuroh, F. Monado, M. Ariani, Hadi, E. Koriyanti, and Erni, “Analisis Akurasi Model Mobilenetv2 Dalam Klasifikasi Citra X-Ray Untuk Deteksi Kondisi Paru-paru,” J. Online Phys., vol. 10, no. 3, pp. 67–74, 2025, doi: 10.22437/jop.v10i3.44453.

D. F. Rajendra and A. K. Wardhana, “Development of MobileNetV2 for CT-Scan Lung Classification Using Transfer Learning,” vol. 9, no. 5, pp. 2703–2710, 2025, doi: 10.30871/jaic.v9i5.10282.

A. Musha, A. Al Mamun, A. Tahabilder, J. Hossen, B. Jahan, and S. Ranjbari, “A deep learning approach for COVID-19 and pneumonia detection from chest X-ray images,” Int. J. Electr. Comput. Eng., vol. 12, no. 4, pp. 3655–3664, 2022, doi: 10.11591/ijece.v12i4.pp3655-3664.

M. F. Fadhlurrahman and Y. Wihardi, “Pengenalan Ekspresi Wajah Peserta Didik di Ruang Kelas Menggunakan Vision Transformer ( ViT ),” vol. 4, no. 2, pp. 1047–1058, 2025.

N. S. Mahajaya, P. D. W. Ayu, and R. R. Huizen, “Pengaruh optimizer adam, adamw, sgd, dan lamb terhadap model vision transformer pada klasifikasi penyakit paru-paru,” Spinter 2024, vol. 1, no. 2, pp. 818–823, 2024, [Online]. Available: https://spinter.stikom-bali.ac.id/index.php/spinter/article/view/222/188

R. R. Ar, Agusriyati, and S. Moka, “Pendeteksian Dini Stunting Pada Balita Menggunakan Vision Transformer (VIT) Berbasis Citra Tubuh,” J. Inform. dan Tek. Elektro Terap., vol. 13, no. 3S1, pp. 896–902, 2025, doi: 10.23960/jitet.v13i3S1.7888.

S. Angara, N. R. Mannuru, A. Mannuru, and S. Thirunagaru, “A novel method to enhance pneumonia detec1on via a model-level ensembling of CNN and vision transformer,” vol. 6, no. 1, pp. 21–28, 2024, doi: 10.48550/arXiv.2401.02358.

T. B. Sasongko, H. Haryoko, and A. Amrullah, “Analisis Efek Augmentasi Dataset dan Fine Tune pada Algoritma Pre-Trained Convolutional Neural Network (CNN),” J. Teknol. Inf. dan Ilmu Komput., vol. 10, no. 4, pp. 763–768, 2023, doi: 10.25126/jtiik.20241046583.

M. A. Mutasodirin and F. M. Falakh, “Efficient Weather Classification Using DenseNet and EfficientNet,” J. Inform. J. Pengemb. IT, vol. 9, no. 2, pp. 173–179, 2024, doi: 10.30591/jpit.v9i2.7539.

N. S. Mahajaya, Putu Desiana Wulaning Ayu, and Roy Rudolf Huizen, “Classification of Lung Diseases in X-Ray Images Using Transformer-Based Deep Learning Models,” J. Nas. Pendidik. Tek. Inform., vol. 13, no. 3, pp. 494–505, 2024, doi: 10.23887/janapati.v13i3.81425.

D. S. Kermany et al., “Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning,” CellPress, vol. 172, no. 5, pp. 1122–1131, Feb. 2018, doi: 10.1016/j.cell.2018.02.010.

Downloads

Published

2026-02-15

How to Cite

Shomsomi, M., Triawan, W., & Purwadi. (2026). Classification of Pneumonia Using CNN and Vision Transformer. Journal of Artificial Intelligence and Engineering Applications (JAIEA), 5(2), 2495–2504. https://doi.org/10.59934/jaiea.v5i2.1906