Code for Deep Predictive Motion Tracking in Magnetic Resonance Imaging: Application to Fetal Imaging to model robust spatiotemporal motion in fetal MRI
- Install all the dependencies in python >v3.6 using
python setup.py install
- The
main.py
script runs all training and evaluation OR just evaluation using a pretrained model. - Simply configure the
sample_experiment.json
in./experiments
directory and pass it as an argument to the main script
>>> python main.py ./experiments/sample_experiment.json
- If step 2 is training then once the model is trained, the results of held out test set, a copy of experiments .json and model itself will be persisted to given directory.
- An example of how to configure experiments is put in ./experiments directory.
- If a pretrained model path is provided then only evaluation will be done by loading the pretrained model otherwise training from scratch will be performed.
- We have used CUDA implementation of LSTM which needs a NVIDIA GPU to train these models however in
./models/our_model.py
you can switchCuDNNLSTM
by genericLSTM
to train on CPU. - In
./experiments/sample_experiment.json
you will findnetwork
section where you can define what kind of network you would like to train fromresnet18
,vgg16
,direct_lstm
, andour_model
where inour_model
you can specify whether to train asingle_head: true
network orsingle_head: false
model as well has size of layers usinghidden_units: 512
. - In data section of
./experiments/sample_experiment.json
you can also setmask: true/false
to enable training models on masked/unmasked data.
To download pretrained models please visit this gdrive link and place them in preferably
./models
directory