An adaptive X‑ray denoising framework that routes each pixel/region through either:
- a fast direct-mapping path (Enhanced NAFNet) for smoother/easier regions, or
- a high-fidelity diffusion path (DDIM-based) for texture-rich / structurally complex regions,
then combines outputs via an attention-based fusion module to produce a clean, structurally faithful radiograph.
Medical X‑ray images often suffer from speckle, quantum, and Poisson noise. These degradations can obscure subtle anatomical details (bone edges, rib structures, joint boundaries, soft‑tissue transitions). Classic filters may blur features, CNN denoisers can oversmooth, and diffusion models can be slow.
This project targets a balanced solution: high quality where needed + speed where possible.
- PSNR: 35.80 dB
- SSIM: 0.9282
- Inference time: ~0.7s on NVIDIA Tesla P100
- Training data: 500 paired X‑ray images
.
├── Backend/ # FastAPI server + PyTorch models
│ ├── run.py # Backend entrypoint (uvicorn)
│ ├── requirements.txt # Backend Python deps
│ └── models/ # Model weights (ignored by git)
└── frontend/ # React UI
├── package.json
└── src/
From the repo root:
cd Backend
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
python run.pyBackend will start at:
- API:
http://127.0.0.1:8000 - Docs:
http://127.0.0.1:8000/docs
Backend/run.py loads checkpoints from Backend/models/ with these filenames:
ddimdiffusion.pthNafNet.pthDirectUNet.pthLatest_Hybrid_Denoiser.pth
Note:
Backend/models/is intentionally ignored in.gitignore(model weights are typically too large for GitHub and may have redistribution constraints).
If you want to ship weights, use Git LFS or provide a download link.
In a new terminal:
cd frontend
npm install
npm startFrontend will typically run at http://localhost:3000.
GET /— service status + available endpointsGET /health— health check + model-loaded flagsPOST /denoise— upload an image and receive base64 PNG outputs from:- diffusion
- nafnet
- expert
- hybrid
From the repo root (PowerShell or terminal):
git init
git add .
git commit -m "Initial commit: hybrid x-ray denoising (backend + frontend)"
git branch -M main
git remote add origin <YOUR_GITHUB_REPO_URL>
git push -u origin main- This repo contains large folders (e.g.,
Backend/venv/, datasets, weights). The root.gitignoreis configured to keep these out of version control. - If you need to share model checkpoints, prefer Git LFS or a release artifact / cloud link.

