CC-NET: class-conditioned latent diffusion for breast-mass patches (CBIS-DDSM)
The generator from Understanding the Utility of Synthetic Images for Breast Mass Classification under Differential Privacy (MIDL 2027 submission). Code: https://github.com/hajarlachheb/mammography-diffusion-dp.
Stable Diffusion 2.1-base U-Net fine-tuned to generate 256×256 grayscale patches of benign or malignant breast masses. A learned class embedding replaces text conditioning as the cross-attention input.
Files
| File | Contents |
|---|---|
ccnet_cbis_ddsm_epoch22_unet.pt | state dict of the class-conditioned U-Net (U-Net + 2-class embedding), 687 tensors, 3,463,893,379 bytes, sha256 a255e932f3f7fff8c21e7bb16fcc5160f645343aacfcdc6fa9375b6dcaa9784a |
ccnet_cbis_ddsm_epoch22_unet.json | export record: epoch, loss, latent scale, base model and source-checkpoint hash |
No VAE and no text encoder are included: the frozen VAE is loaded from the base model. The file holds tensors only
and loads with torch.load(..., weights_only=True).
Usage
git clone https://github.com/hajarlachheb/mammography-diffusion-dp.git && cd mammography-diffusion-dp
pip install -r requirements.txt diffusers==0.30.3 transformers==4.45.2 accelerate==1.0.1
python generation/ccnet/generate_ccnet.py \
--model_path ccnet_cbis_ddsm_epoch22_unet.pt \
--output_dir synthetic_ccnet \
--num_samples_per_class 1500 --num_inference_steps 50 --scheduler ddim \
--scale_factor 0.1 --batch_size 1 --seed 42
Pass --scale_factor 0.1. Images are written to is_benign_true/ and is_benign_false/.
Training
| Data | 1,104 CBIS-DDSM mass patches (579 benign, 525 malignant) from 578 patients; the mammo_dp training split |
| Base model | Manojb/stable-diffusion-2-1-base (a third-party upload of SD 2.1-base) |
| Settings | 256×256, latent scale 0.1, 25 epochs, batch 4 × 64 gradient accumulation, learning rate 1e-4, fp16, seed 2 |
| Selected checkpoint | epoch 22, lowest mean training loss (0.1068) |
| Sampling in the paper | 1,500 patches per class, 50 DDIM steps, seed 42 |
The source training checkpoint (with optimizer state) has sha256
822f9f205d99ee146bfbe7204a8449ce0f8a97a5b2f12cecc7953e3260d5d6d6; this file is its model state dict.
Intended use and limitations
- Research only. Studying synthetic data for breast-mass classification. Not a medical device; generated images must not be used for diagnosis.
- No privacy guarantee. The model was trained without differential privacy on patient images. In the paper's nearest-neighbour check, 5.2 % of 3,000 generated patches were closer in pixel distance to a training patch than the test-set threshold, while almost none were in DINOv3 feature space. This does not show the absence of memorisation. Do not treat the model or its outputs as anonymised data.
- Scope. Trained on mass patches from one public dataset (digitised film mammograms). It does not generate full mammograms and may not transfer to other populations or devices.
- Provenance. The training configuration is verified from the original log and checkpoint metadata. That this checkpoint produced the paper's 3,000-patch pool is strongly supported but not proven.
License
CreativeML Open RAIL++-M, inherited from Stable Diffusion 2.1, including its use restrictions. The CBIS-DDSM data (TCIA, CC BY 3.0) is not distributed here; cite Lee et al., Scientific Data 2017 when using derived models.