fastmri是FaceBook和紐約大學醫學院放射科合作的一個項目,旨在用深度學習的方法加速MRI重建。
代碼:https://github.com/tianxiaoxiao2018/fastMRI
數據:https://fastmri.med.nyu.edu/
調試:
1、首先按照教程裝依賴包,我用下面的 pip install -r requirments.txt有報錯的地方。所以我是直接打開requirments.txt,一個一個手動裝包。
torch0.4.1 它提供的版本報錯。所以我按照下面這個網址的方法裝,https://blog.csdn.net/zywvvd/article/details/86685871
2、裝好依賴包後,修改程序。
1)把/home/tianxiaoxiao/code/fastMRI-master/文件夾下的common和data文件夾放到/home/tianxiaoxiao/code/fastMRI-master0/models/unet下,否則會提示找不到common和data模塊。
2)再修改/home/tianxiaoxiao/code/fastMRI-master0/models/unet下的train_unet.py文件,將27行的from models.unet.unet_model import UnetModel修改爲下圖所示,否則又會出現找不到模塊model。
3、調試
1)定位到你的unet目錄下,我的是:
cd /home/tianxiaoxiao/code/fastMRI-master0/models/unet
2)訓練:challenge 爲singlecoil 。添加數據路徑(就是你放數據的地方,照着我這個弄吧),我的如下所示。
CUDA_VISIBLE_DEVICES=4 python train_unet.py --challenge singlecoil --data-path /home/tianxiaoxiao/code/fastMRI-master0/models/unet --exp-dir checkpoint
3)要在驗證數據上運行模型:
CUDA_VISIBLE_DEVICES=3 python run_unet.py --data-path /home/tianxiaoxiao/code/fastMRI-master0/models/unet --data-split val --checkpoint checkpoint/best_model.pt --challenge singlecoil --out-dir reconstructions_val
輸出將保存到reconstructions_val.
4)
要在測試數據上運行模型:
CUDA_VISIBLE_DEVICES=5 python run_unet.py --data-path /home/tianxiaoxiao/code/fastMRI-master0/models/unet --data-split test --checkpoint checkpoint/best_model.pt --challenge singlecoil --out-dir reconstructions_test
輸出將保存到reconstructions_test
目錄中,可以上傳以供提交。
4、查看日誌
tensorboard --logdir=/home/tianxiaoxiao/code/keras-master/examples --port=12345
日誌參考博客(我用的服務器,要改端口):https://blog.csdn.net/index20001/article/details/82871634