-
Data Preparation
- Use
preprocessing/generateSlicesForNetwork3D.py
to package images as slices.- Creates numpy slices for model input during training.
- Saves metadata containing dataset extremes (min and max values).
- Saves image IDs.
- Optionally, create a smaller batch of slices for test images to be generated every X epochs to check visual quality.
- Use
-
Training
- Run
train_3D.py
to train the model.
- Run
-
input_seq: The input sequence for the model.
-
output_seq: The output sequence for the model.
-
database: Specifies the database to be used.
- Options:
"Heidelberg"
or"PEGASUS"
- Options:
-
data: Specifies the shorthand for the database.
- Default:
["hdb"]
for Heidelberg,["peg"]
for PEGASUS
- Default:
-
model_path: Directory path where models are saved.
-
gen_img_path: Directory path where generated images are saved.
-
extremesDate: Date on which the file with min/max values of the cohort was created.
-
gen_input_img_path_3D: Path for input images used during generation.
-
gen_output_img_path_3D: Path for output images used during generation.
-
extremesFile: Filename for the extremes file.
-
specificImgsToGen: Specific images to generate during training for visual checks.
-
save_model: Save model
-
save_every_X_epoch: Frequency of saving the model.
-
generate_while_train: Generate slices during model training.
-
nr_imgs_gen: Number of images to generate (up to five).
-
sliceToShow: Slice to generate as an example of model progression.
-
epochs: Number of training epochs.
- Default:
80
- Default:
-
paddingMode: Padding mode for convolutions.
- Default:
"reflect"
- Default:
-
model_name: Name of the model.
- Default:
'pix2pix-pytorch'
- Default:
-
upsampling: Use upsampling instead of convtranspose.
- Default:
False
- Default:
-
batch_size: Size of the training batches.
- Default:
8
- Default:
-
ngf: Number of generator filters.
- Default:
256
- Default:
-
nr_layer_g: Number of layers in the generator (UnetG).
- Default:
7
- Default:
-
nr_layer_d: Number of layers in the discriminator (PatchD).
- Default:
3
- Default:
-
ndf: Number of discriminator filters.
- Default:
64
- Default:
-
niter: Number of iterations.
- Default:
10
- Default:
-
lr_g: Learning rate for the generator.
- Default:
0.0001
- Default:
-
lr_d: Learning rate for the discriminator.
- Default:
0.00001
- Default:
-
dropout_rate: Dropout rate.
- Default:
0
- Default:
-
weightinit: Weight initialization method.
- Default:
"normal"
- Default:
-
init_sd: Initial standard deviation for normal distribution.
- Default:
0.05
- Default:
-
init_mean: Initial mean for normal distribution.
- Default:
0
- Default:
-
slope_relu: Slope for ReLU.
- Default:
0.2
- Default:
-
patchD: Use patch discriminator.
- Default:
True
- Default:
-
kernel_size: Kernel size (only for no patchD).
- Default:
5
- Default:
-
netG_type: Type of generator network.
- Default:
"unet"
- Default:
-
pretrainedG: Use pretrained generator (only for UnetG).
- Default:
False
- Default:
-
feature_matching: Use feature matching (only possible when no patchD).
- Default:
False
- Default:
-
label_smoothing: Use label smoothing.
- Default:
False
- Default:
-
criterion_d: Loss criterion for the discriminator.
- Default:
"BCE"
- Default:
-
criterion_g: Loss criterion for the generator.
- Default:
"BCE"
- Default:
-
loss_ratio: Ratio for updating loss.
- Default:
False
- Default:
-
reconstruction_loss: Type of reconstruction loss.
- Default:
"L1-SSIM"
- Default:
-
optimizer_d: Optimizer for the discriminator.
- Default:
"adam"
- Default:
-
beta1_d: Beta1 parameter for the discriminator's optimizer.
- Default:
0.5
- Default:
-
beta1_g: Beta1 parameter for the generator's optimizer.
- Default:
0.5
- Default:
-
beta2_d: Beta2 parameter for the discriminator's optimizer.
- Default:
0.999
- Default:
-
beta2_g: Beta2 parameter for the generator's optimizer.
- Default:
0.999
- Default:
-
WGAN: Use Wasserstein GAN.
- Default:
False
- Default:
-
lbd: Lambda parameter for WGAN.
- Default:
10
- Default:
-
nr_d_train: Number of discriminator training steps per generator step.
- Default:
1
- Default:
-
continue_training: Continue training from a saved checkpoint.
- Default:
False
- Default:
-
load_from_epoch: Epoch number to load the model from.
- Default:
20
- Default:
-
metrics: List of evaluation metrics.
- Default:
["MSE", "NRMSE", "PSNR", "SSIM", "MAE"]
- Default:
-
save_nii: Save results in NIfTI format.
- Default:
True
- Default:
- generate_images_3D_inference.py: Run model in inference mode for test set.