This repository contains the training source code for a ConvNeXt-Base architecture augmented with Convolutional Block Attention Modules (CBAM). The model utilizes a multi-label classification approach fine-tuned on the CheXpert dataset to detect 14 thoracic pathologies.
The primary objective of this project is to enhance model interpretability in medical diagnostics. By integrating channel and spatial attention mechanisms, the model improves feature localization, which is validated through Gradient-weighted Class Activation Mapping (Grad-CAM).
Validation Performance: 0.81 Mean AUC Architecture: ConvNeXt-Base + CBAM
Due to repository size constraints, the trained model weights and the inference pipeline are hosted externally on Hugging Face Spaces.
Launch Grad-CAM Demo on Hugging Face Spaces
The codebase is organized as follows:
.
├── src/ # Source code
│ ├── gradcam_single.py # Script for Grad-CAM analysis
│ └── training/ # Training modules
│ └── train.py # Main training entry point
├── assets/ # Project assets and visualizations
│ └── analysis.png # Sample Grad-CAM outputs
├── requirements.txt # Python dependencies
└── README.md
Installation
To set up the environment for training or development:
Bash
git clone [https://github.com/jikaan/convnext-chexpert-attention.git](https://github.com/jikaan/convnext-chexpert-attention.git)
cd convnext-chexpert-attention
pip install -r requirements.txt
Training Configuration
To reproduce the training results (Iteration 6), execute the training script located in the source directory. The pipeline handles dataset loading, image augmentation, and the Focal Loss objective function.
python src/training/train.py \
--data_dir /path/to/chexpert_dataset \
--batch_size 4 \
--epochs 3 \
--lr 2e-5Performance Benchmarks
The model was evaluated on the CheXpert Validation Set using the Area Under the Curve (AUC) metric. Metric Score Configuration Mean AUC 0.81 ConvNeXt-Base + CBAM Input Resolution 384x384 Bicubic Interpolation Optimizer AdamW Lookahead Wrapper
Citation
If you utilize this repository or methodology in your research, please cite the following:
Code snippet
@misc{convnext_cbam_2025,
author = {Calender, S.},
title = {ConvNeXt-CheXpert: Attention-Based Thoracic Classifier},
year = {2025},
publisher = {GitHub},
url = {[https://github.com/jikaan/convnext-chexpert-attention](https://github.com/jikaan/convnext-chexpert-attention)}
}
License
This project is licensed under the Apache 2.0 License.