You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UNETR/BTCV/README.md
+45-23Lines changed: 45 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,22 @@
1
1
# Model Overview
2
+
2
3
This repository contains the code for UNETR: Transformers for 3D Medical Image Segmentation [1]. UNETR is the first 3D segmentation network that uses a pure vision transformer as its encoder without relying on CNNs for feature extraction.
3
4
The code presents a volumetric (3D) multi-organ segmentation application using the BTCV challenge dataset.
Once downloaded, please place the checkpoint in the following directory or use ```--pretrained_dir``` to provide the address of where the model is placed:
72
+
Once downloaded, please place the checkpoint in the following directory or use `--pretrained_dir` to provide the address of where the model is placed:
68
73
69
-
```./pretrained_models```
74
+
`./pretrained_models`
70
75
71
76
The following command initiates finetuning using the pretrained checkpoint:
72
-
```bash
77
+
78
+
```bash
73
79
python main.py
74
80
--batch_size=1
75
81
--logdir=unetr_pretrained
@@ -88,12 +94,13 @@ For using the pre-trained TorchScript model, please download the model from the
Once downloaded, please place the TorchScript model in the following directory or use ```--pretrained_dir``` to provide the address of where the model is placed:
97
+
Once downloaded, please place the TorchScript model in the following directory or use `--pretrained_dir` to provide the address of where the model is placed:
92
98
93
-
```./pretrained_models```
99
+
`./pretrained_models`
94
100
95
101
The following command initiates finetuning using the TorchScript model:
96
-
```bash
102
+
103
+
```bash
97
104
python main.py
98
105
--batch_size=1
99
106
--logdir=unetr_pretrained
@@ -108,39 +115,53 @@ python main.py
108
115
--pretrained_model_name='UNETR_model_best_acc.pt'
109
116
--resume_jit
110
117
```
111
-
Note that finetuning from the provided TorchScript model does not support AMP.
112
118
119
+
Note that finetuning from the provided TorchScript model does not support AMP.
113
120
114
121
### Testing
122
+
115
123
You can use the state-of-the-art pre-trained TorchScript model or checkpoint of UNETR to test it on your own data.
116
124
117
125
Once the pretrained weights are downloaded, using the links above, please place the TorchScript model in the following directory or
118
-
use ```--pretrained_dir``` to provide the address of where the model is placed:
126
+
use `--pretrained_dir` to provide the address of where the model is placed:
127
+
128
+
`./pretrained_models`
119
129
120
-
```./pretrained_models```
130
+
The following command runs inference(validation or predict mask) using the provided checkpoint:
121
131
122
-
The following command runs inference using the provided checkpoint:
123
-
```bash
132
+
```bash
124
133
python test.py
134
+
--mode='validation'
125
135
--infer_overlap=0.5
126
136
--data_dir=/dataset/dataset0/
127
137
--pretrained_dir='./pretrained_models/'
128
138
--saved_checkpoint=ckpt
129
139
```
130
140
131
-
Note that ```--infer_overlap``` determines the overlap between the sliding window patches. A higher value typically results in more accurate segmentation outputs but with the cost of longer inference time.
141
+
```bash
142
+
python test.py
143
+
--mode='predict'
144
+
--infer_overlap=0.5
145
+
--pretrained_dir='./pretrained_models/'
146
+
--saved_checkpoint=ckpt
147
+
```
148
+
149
+
Note that `--infer_overlap` determines the overlap between the sliding window patches. A higher value typically results in more accurate segmentation outputs but with the cost of longer inference time.
132
150
133
-
If you would like to use the pretrained TorchScript model, ```--saved_checkpoint=torchscript``` should be used.
151
+
If you would like to use the pretrained TorchScript model, `--saved_checkpoint=torchscript` should be used.
134
152
135
153
### Tutorial
154
+
136
155
A tutorial for the task of multi-organ segmentation using BTCV dataset can be found in the following:
0 commit comments