surajpaib commited on
Commit
c9b7eee
·
verified ·
1 Parent(s): f51487d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -3
README.md CHANGED
@@ -1,3 +1,26 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ Instructions to load the pre-trained model weights
6
+
7
+ ```python
8
+ import torch
9
+ from monai.networks.nets import SegResNetDS
10
+
11
+ weights = torch.load("pretrained_segresnet.torch")
12
+
13
+ model = SegResNetDS(
14
+ blocks_down=(1, 2, 2, 4, 4)
15
+ )
16
+
17
+ model.load_state_dict(weights, strict=False) # Set strict to False as we load only the encoder
18
+
19
+ # Dummy forward pass
20
+ tensor = torch.randn((2, 1, 32, 32, 32))
21
+
22
+ # Note that the input data needs to be in "SPL" format (OR z,y,x default numpy/torch format),
23
+ # you can use Orientation transform in MONAI set with value "SPL".
24
+ # Note: All subsequent transforms must be applied in (z,y,x) format. Eg patch size of [16, 32, 32] corresponds to 16 in z-axis
25
+ out = model(tensor)
26
+ ```