CycleGAN项目记录(完结)
服务器54
数据准备
转.nii.gz
数据清洗
准备2D/3D数据
-
2D
data/path/
-
3D
data/path/
模型训练
2D
wandb offline # 54服务器连不上网
python /homes/xchang/Projects/Done/pytorch-CycleGAN-and-pix2pix-master/generate_image/train.py --dataroot /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/2d --name Tuberculosis_2D-CycleGAN_202312211633 --model cycle_gan --seed 1995 --gpu_ids 0 --input_nc 1 --output_nc 1 --batch_size 3 --preprocess none --update_html_freq 1 --n_epochs 25 --n_epochs_decay 25 #>> log/2D-train_202312121800.log # --use_wandb
3D
wandb offline # 54服务器连不上网
python /homes/xchang/Projects/Future/3D-CycleGan-Pytorch-MedImaging-main/train.py --data_path /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/3D/train/ --val_path /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/3D/train/ --niter 200 --niter_decay 200 --gpu_ids 1, --name Tuberculosis_3D-CycleGAN_202311301637 --print_freq 1 --save_epoch_freq 1 --save_latest_freq 1 >> train/train_202311301637.log
3D: check load patches
python /homes/xchang/Projects/Future/3D-CycleGan-Pytorch-MedImaging-main/check_loader_patches.py --data_path /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/3D/train/
训练结果
pwd/checkpoints/{--name}
模型预测
2D
python /homes/xchang/Projects/Done/pytorch-CycleGAN-and-pix2pix-master/generate_image/test.py --dataroot /homes/xchang/Data/Multi-center_Tuberculosis/translation/2d/8bit_resize_crop/testA --name Tuberculosis_2D-CycleGAN_202312121800_inference --model test --no_dropout --input_nc 1 --output_nc 1 --num_test 23100 --epoch 140
- 数据位置
- 模型位置
3D
# 仅支持单个case的预测,若要预测多个case,参考
# 'https://blog.csdn.net/qq_45794210/article/details/125119119',直接修改test.py文件
python /homes/xchang/Projects/Future/3D-CycleGan-Pytorch-MedImaging-main/test.py --image /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/3D/train/images/130202_4.nii.gz --result /homes/xchang/Data/Multi-center_Tuberculosis/translation_demo/3D/inference/epoch_280/result_130202_4.nii.gz --name Tuberculosis_3D-CycleGAN_202311301637_inference
- 数据位置
- 模型位置
预测结果
2D(pwd/results/{--name})
3D(--result指定)