Highlights#
- Fine-tuned an ImageNet-pretrained Xception in TensorFlow/Keras to classify lung disease from 4,575 chest X-ray images, reaching 94.53% accuracy with 0.945 F1.
- Quantified the value of transfer learning by training the identical architecture from scratch, which reached only 85.56% accuracy, 9 points below the pretrained model.
- Published the full experiment as a public Kaggle notebook.
How it works#
flowchart TD
A["Chest X-ray dataset
4,575 images, balanced classes"] --> B["Preprocessing & cleaning"]
B --> C["Xception
ImageNet weights"]
C --> D["Fine-tuning"]
D --> E["Evaluation
94.53% acc, F1 0.945"]
B --> F["Xception
from scratch"]
F --> G["85.56% accuracy"]
Case Study#
Problem. The task is computer-aided classification of lung disease from chest X-ray images. Labeled medical imaging data is scarce; with only 4,575 labeled images, the question is how much of the final accuracy comes from ImageNet pretraining rather than from the X-rays themselves.
Approach. The project used the Xception architecture in TensorFlow/Keras. The central methodological choice was a clean ablation: train the exact same network twice, once from random initialization and once from ImageNet weights with fine-tuning, so the accuracy difference is attributable to pretraining. Before training, the dataset needed preprocessing and cleaning to deal with issues such as missing metadata.
Outcome. The fine-tuned model reached 94.53% accuracy, with precision 0.949, recall 0.945 and F1 0.945. The from-scratch model stopped at 85.56%, a 9-point gap.
Links. Project report (PDF, Google Drive) · Kaggle notebook: lung-disease-prediction-from-chest-x-ray-xception
Stack#
Python, TensorFlow, Keras, Xception, Kaggle Notebooks
