原始项目:https://github.com/MICV-yonsei/CT2MRI/tree/main
1. 数据预处理
1.1 生成hdf5文件
如果数据格式为.raw,且形状为(num, height, width) = (160, 224, 168),即师兄的数据。
那么使用 generate_total_hdf5_csv_niys.py
文件。
下面这行代码是创建头颅的训练数据集:
python3 generate_total_hdf5_csv_niys.py --data_dir ../../data/preprocess_globalNormAndEnContrast --which_set train --hdf5_name 160_train_axial.hdf5
创建结果如下:
Subject 070 done in 1.422 seconds.
Successfully written train_data_brain.hdf5 in 139.905 seconds.
(11200, 2)
(224, 168, 11200)
11200
下面这行代码是创建头颅的测试数据集:
python3 generate_total_hdf5_csv_niys.py --data_dir ../../data/preprocess_globalNormAndEnContrast --which_set test --hdf5_name 160_valid_axial.hdf5
创建结果如下:
Successfully written test_data_brain.hdf5 in 40.116 seconds.
(4800, 2)
(224, 168, 4800)
4800
1.2 创建pkl文件
在shell/data/文件夹下运行 make_hist_dataset_niys.sh
脚本。
2. 训练
2.1 训练头颅
进入shell/train文件夹下。
./train.sh
Bugs
Bugs.1 ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/dell/anaconda3/envs/pytorch-gpu/lib/python3.9/site-packages/google/protobuf/pyext/_message.cpython-39-x86_64-linux-gnu.so)
参考:https://blog.csdn.net/weixin_42166222/article/details/129402507
Bugs.2 使用wandb报错:ERROR Error while calling W&B API: project not found (<Response [404]>)
参考:https://blog.csdn.net/weixin_43835996/article/details/126955917