Example88 commited on
Commit
845a94e
·
1 Parent(s): 3a91914

added model use

Browse files
Files changed (1) hide show
  1. README.md +49 -2
README.md CHANGED
@@ -20,9 +20,56 @@ This model can be used to reconstruct brain data from Siemens scanner at acceler
20
  It was shown [here](https://arxiv.org/abs/2106.00753), that it can generalize well, although further tests are required.
21
 
22
  ## How to use
23
- This model can be loaded using the following repo: https://github.com/zaccharieramzi/fastmri-reproducible-benchmark
 
24
  The framework is TensorFlow.
25
- Example notebooks and detailed use guides are WIP.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ## Limitations and bias
28
  The limitations and bias of this model have not been properly investigated.
 
20
  It was shown [here](https://arxiv.org/abs/2106.00753), that it can generalize well, although further tests are required.
21
 
22
  ## How to use
23
+ This model can be loaded using the following repo: https://github.com/zaccharieramzi/fastmri-reproducible-benchmark.
24
+ After cloning the repo, `git clone https://github.com/zaccharieramzi/fastmri-reproducible-benchmark`, you can install the package via `pip install fastmri-reproducible-benchmark`.
25
  The framework is TensorFlow.
26
+
27
+ You can initialize and load the model weights as follows:
28
+ ```python
29
+ import tensorflow as tf
30
+
31
+ from fastmri_recon.models.subclassed_models.denoisers.proposed_params import get_model_specs
32
+ from fastmri_recon.models.subclassed_models.xpdnet import XPDNet
33
+
34
+
35
+ n_primal = 5
36
+ model_fun, model_kwargs, n_scales, res = [
37
+ (model_fun, kwargs, n_scales, res)
38
+ for m_name, m_size, model_fun, kwargs, _, n_scales, res in get_model_specs(n_primal=n_primal, force_res=False)
39
+ if m_name == 'MWCNN' and m_size == 'medium'
40
+ ][0]
41
+ model_kwargs['use_bias'] = False
42
+ run_params = dict(
43
+ n_primal=n_primal,
44
+ multicoil=True,
45
+ n_scales=n_scales,
46
+ refine_smaps=True,
47
+ refine_big=True,
48
+ res=res,
49
+ output_shape_spec=True,
50
+ n_iter=25,
51
+ )
52
+ model = XPDNet(model_fun, model_kwargs, **run_params)
53
+ kspace_size = [1, 1, 320, 320]
54
+ inputs = [
55
+ tf.zeros(kspace_size + [1], dtype=tf.complex64), # kspace
56
+ tf.zeros(kspace_size, dtype=tf.complex64), # mask
57
+ tf.zeros(kspace_size, dtype=tf.complex64), # smaps
58
+ tf.constant([[320, 320]]), # shape
59
+ ]
60
+ model(inputs)
61
+ model.load_weights('xpdnet_sense_brain__af4_i25_compound_mssim_rf_smb_MWCNNmedium_1601987069-100.h5')
62
+ ```
63
+
64
+ Using the model is then as simple as:
65
+ ```python
66
+ model([
67
+ kspace, # shape: [n_slices, n_coils, n_rows, n_cols, 1]
68
+ mask, # shape: [n_slices, n_coils, n_rows, n_cols]
69
+ smaps, # shape: [n_slices, n_coils, n_rows, n_cols]
70
+ shape, # shape: [n_slices, 2]
71
+ ])
72
+ ```
73
 
74
  ## Limitations and bias
75
  The limitations and bias of this model have not been properly investigated.