This repo contains code for our CheX-ray14 super-resolution experiments:
- MUNIT-LQ: low-quality (LQ) inputs generated from the CheX-ray14 test set (external MUNIT pipeline).
- DDPM-HQ: a diffusion-based super-resolution model (CheffSR/SR3-style) trained / fine-tuned on HQ–LQ pairs to map LQ → HQ.
- DDPM-HQ outputs: final super-res outputs produced by the DDPM-HQ model.
Most relevant entrypoints:
- Inference:
cheff/sr/sampler.py,inference_batch_ddp.py - Training (DDP):
Train/train_ddpm_e2e.py,Train/train_sr_ddpm.py
We use the conda environment spec at cascade7.yaml:
conda env create -f cascade7.yaml
conda activate cascade7- Diffusion-based baseline (bicubic SR):
/raid1/data_transfer/data/CheX-ray14/test_chexraybase_sr_bicubic/ - DDPM-HQ outputs (DDPM on LQ inputs) (per-GPU folder):
/raid1/data_transfer/data/CheX-ray14/test_lr_ddpm_2/folder_x/ - MUNIT-LQ outputs:
/raid2/data_transfer/data/CheX-ray14/test_lr_munit/all_images/all_images/ - DDPM-HQ outputs:
/raid1/data_transfer/data/CheX-ray14/test_munit_sr_ddpm/
- Folder:
/raid/collected_100_4way/diffusion_baseline/ddpm_lq/munit_lq/final_with_masks/(DDPM-HQ outputs)low_res_latest_160k/(a 100-image low-res subset)
- Zip (4-way only):
/raid/collected_100_4way.zip - Zip (4-way + low-res):
/raid/collected_100_4way_with_lowres.zip
Reference output path (already generated on servers):
/raid2/data_transfer/data/CheX-ray14/test_lr_munit/all_images/all_images/
Notes:
- Filenames are like
00000013_016.png(nosuper_resolved_prefix). - These images are used as LQ inputs to the DDPM-HQ SR model.
We train / fine-tune a CheffSR/SR3 diffusion model on HQ–LQ pairs to map LQ → HQ.
Entrypoints:
Train/train_ddpm_e2e.pyTrain/scripts/04_train_chex_ddpm_ddp.py(same training loop style)
Run (important: diffusion.* imports live under Train/, so run from Train/):
cd /raid1/data_transfer/data/chexray-diffusion/Train
PYTHONPATH=. python train_ddpm_e2e.pyUpdate paths inside BASE_CONFIG:
data_root: MaCheX root (expects subfolders each containing anindex.json)resume_checkpoint: optional checkpoint to resume fromlog_dir: where checkpoints are saved
Entrypoint:
Train/train_sr_ddpm.py
By default it expects:
data_root/low_res_latest/(PNG/JPG images)
In our setup, the latest low-res pool is here:
/raid2/data_transfer/low_res_latest_160k/
If you want to use it without changing code, create a symlink named low_res_latest next to it:
ln -s /raid2/data_transfer/low_res_latest_160k /raid2/data_transfer/low_res_latestRun:
cd /raid1/data_transfer/data/chexray-diffusion/Train
PYTHONPATH=. python train_sr_ddpm.pyUpdate paths inside BASE_CONFIG in Train/train_sr_ddpm.py:
data_root: parent directory that containslow_res_latest/resume_checkpoint: base checkpoint to fine-tune fromlog_dir: output checkpoint folder
Entrypoint:
inference_batch_ddp.py
Edit the hardcoded variables at the bottom of the file:
sr_path: checkpoint to loadinput_folder: folder containing input images (.png/.jpg)output_folder: where to write resultsbatch_size: per-GPU batch size
Run:
cd /raid1/data_transfer/data/chexray-diffusion
python inference_batch_ddp.pyOutputs are saved as super_resolved_<original_filename> in output_folder.
Example (CheX-ray14 MUNIT-LQ → DDPM-HQ outputs):
input_folder:/raid2/data_transfer/data/CheX-ray14/test_lr_munit/all_images/all_images/output_folder:/raid1/data_transfer/data/CheX-ray14/test_lr_ddpm_2/folder_1/(or anyfolder_x/)
The core API is implemented in:
cheff/sr/sampler.py(CheffSRModel.sample_path(...),CheffSRModel.sample_directory(...))
- Training script imports:
Train/train_*.pyimportsdiffusion.*fromTrain/diffusion/, so either:- run from
chexray-diffusion/TrainwithPYTHONPATH=., or - set
PYTHONPATH=/raid1/data_transfer/data/chexray-diffusion/Train.
- run from
inference.pyis a minimal snippet and expects an in-memoryimgstensor; for folder inference preferinference_batch_ddp.pyorCheffSRModel.sample_directory(...).