This is the code for "Pseudo Kinetics-driven Federated Diffusion Hemodynamic Framework for Breast Tumor Segmentation in Pre-contrast MRI"
-
Hardware requirements: This project requires only a standard computer with enough RAM and a NVIDIA GPU to support operations. We ran the demo using the following specs:
- CPU: 10 cores, 2.5 GHz/core
- RAM: 40GB
- GPU: NVIDIA Quadro RTX 8000 (48GB memory)
- CUDA: 11.0
-
System requirements: This tool is supported for Linux. The tool has been tested on the following system:
- Ubtuntu Linux release 18.04.6
-
Clone the Repository:
git clone https://github.com/ttt553/FDKM cd FDKM -
Install Required Packages: The basic environment requirements are:
- Python: 3.10
- CUDA: 11.0
- Pytorch
-
Model pretraining:
python pretrain.py
Please replace the data path using your specific path in the pretrain.py.
You can customize the training process using the following arguments:
| Argument | Description | Default |
|---|---|---|
--ch_mult, |
channel multiplier | [1,2,2,2] |
--ch, |
base channel of UNet | 128 |
--beta_1, |
start beta value | 1e-4 |
--beta_T, |
end beta value | 0.02 |
--T, |
total diffusion steps | 1000 |
--lr, |
target learning rate | 2e-4 |
--img_size |
image size | 128 |
--save_step |
frequency of saving checkpoints | 5000 |
--ema_decay, -c |
ema decay rate | 0.9999 |
- Model training and evaluaiton:
python train.py
The training procedure can be customized via the following command-line arguments:
| Argument | Description | Default |
|---|---|---|
--epochs, -e |
Total number of training epochs | 500 |
--batch-size, -b |
Number of samples per training batch | 1 |
--learning-rate, -l |
Learning rate for the optimizer | 1e-5 |
--load, -f |
Path to a checkpoint .pth file to resume training from |
None |
--scale, -s |
Factor by which to downscale input images | 1 |
--validation, -v |
Percentage of the dataset reserved for validation (range: 0-100) | 20.0 |
--amp |
Enable Automatic Mixed Precision (AMP) during training | Disabled |
--bilinear |
Utilize bilinear upsampling in the network architecture | Disabled |
--classes, -c |
Number of output classes for segmentation | 1 |
| |
- Model testing:
python test.py
