Abstract
This repository contains the code, trained models, and web application developed for the paper: Explainable Two-Stage Xception-Swin Transformer Learning for Body-Part-Aware Fracture Detection in Musculoskeletal X-Rays Overview Musculoskeletal radiograph analysis remains challenging because upper-extremity X-rays exhibit substantial anatomical variability, subtle fracture patterns, projection differences, overlapping structures, and class imbalance. To address these challenges, this project implements an explainable two-stage deep learning framework for automated analysis of upper-extremity musculoskeletal radiographs using the MURA dataset. The framework operates in two stages: Body-part classificationThe first stage classifies each radiograph into one of seven anatomical categories:elbow, finger, forearm, hand, humerus, shoulder, and wrist. Body-part-wise abnormality detectionThe second stage performs abnormality detection for the identified anatomical region, classifying the image as abnormal/fracture or normal/non-fracture. The core model is a hybrid Xception-Swin Transformer architecture, designed to combine: Xception for local structural feature extraction, Swin Transformer for global contextual modeling, and attention-based feature fusion for integrating complementary information. Explainability To improve transparency and support clinically meaningful interpretation, the framework includes multiple explainable AI (XAI) methods: Grad-CAM Grad-CAM++ Occlusion Sensitivity These methods help visualize the image regions that contribute to the model’s predictions and allow verification that the system relies on anatomically relevant structures rather than spurious artifacts. Repository contents The repository includes: BackendPython-based inference framework with preprocessing, model loading, API routes, abnormality prediction, body-part classification, explainability modules, and full inference pipeline. Trained modelsPretrained checkpoints for: body-part classification abnormality detection for each anatomical region: elbow finger forearm hand humerus shoulder wrist FrontendWeb application for image upload, prediction display, and visual explanation of model outputs. Purpose This repository is intended to support: reproducible research in medical image analysis body-part-aware fracture detection musculoskeletal radiograph classification explainable AI for radiology deployment-oriented experimentation for clinical decision support systems Associated manuscript Title:Explainable Two-Stage Xception-Swin Transformer Learning for Body-Part-Aware Fracture Detection in Musculoskeletal X-Rays Authors:Syed Baqir Hussain Shah, Musfarah Wajid, Syed Adil Hussain Shah, Silvia Godio, Karim Kassem, Gohar Bano Zaidi, Shahzad Ahmad Qureshi, Syed Taimoor Hussain Shah, and Marco Agostino Deriu Repository structure The repository is organized into the following main components: backend/Main Python backend for model inference, preprocessing, explainability, and API services. backend/app/Core backend application code, including: main.py for application entry api/ for route definitions core/ for configuration and constants inference/ for body-part prediction, abnormality prediction, preprocessing, explainability, checkpoint loading, and end-to-end inference schemas/ for data models utils/ for helper functions backend/models/Pretrained checkpoints for: body-part classification body-part-wise abnormality detection across all seven anatomical classes backend/requirements.txtPython dependency list for the backend environment. frontend/Web application source code and configuration files for the user interface. frontend/dist/Built frontend distribution files for deployment. frontend/README.mdFrontend-specific usage and setup instructions. A slightly more compact version is: Repository structure The repository consists of three main parts: backend/: Python inference engine with preprocessing, classification, explainability, and API services backend/models/: pretrained checkpoints for body-part classification and body-part-wise abnormality detection frontend/: web interface for image upload, prediction display, and explanation visualization Key backend files include the application entry point (app/main.py), inference modules, API routes, and dependency specification (requirements.txt), while the frontend contains the application source code and built deployment files. Recommended citation If you use this repository, please cite the associated manuscript and this Zenodo record.