|
25 | 25 | "\n", |
26 | 26 | "The VQVAE can also be used as a generative model if an autoregressor model (e.g., PixelCNN, Decoder Transformer) is trained on the discrete latent representations of the VQVAE bottleneck. This falls outside of the scope of this tutorial.\n", |
27 | 27 | "\n", |
28 | | - "[1] - Oord et al. \"Neural Discrete Representation Learning\" https://arxiv.org/abs/1711.00937\n", |
29 | | - "\n", |
30 | | - "\n", |
31 | | - "### Setup environment" |
| 28 | + "[1] - Oord et al. \"Neural Discrete Representation Learning\" https://arxiv.org/abs/1711.00937" |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "cell_type": "markdown", |
| 33 | + "id": "d167a850", |
| 34 | + "metadata": {}, |
| 35 | + "source": [ |
| 36 | + "## Setup environment" |
32 | 37 | ] |
33 | 38 | }, |
34 | 39 | { |
|
50 | 55 | "id": "6b8ae5e8", |
51 | 56 | "metadata": {}, |
52 | 57 | "source": [ |
53 | | - "### Setup imports" |
| 58 | + "## Setup imports" |
54 | 59 | ] |
55 | 60 | }, |
56 | 61 | { |
|
118 | 123 | "print_config()" |
119 | 124 | ] |
120 | 125 | }, |
121 | | - { |
122 | | - "cell_type": "code", |
123 | | - "execution_count": 2, |
124 | | - "id": "f7f7056e", |
125 | | - "metadata": {}, |
126 | | - "outputs": [], |
127 | | - "source": [ |
128 | | - "# for reproducibility purposes set a seed\n", |
129 | | - "set_determinism(42)" |
130 | | - ] |
131 | | - }, |
132 | | - { |
133 | | - "cell_type": "markdown", |
134 | | - "id": "51a9a628", |
135 | | - "metadata": {}, |
136 | | - "source": [ |
137 | | - "### Setup a data directory and download dataset" |
138 | | - ] |
139 | | - }, |
140 | 126 | { |
141 | 127 | "cell_type": "markdown", |
142 | 128 | "id": "9b9b6e14", |
143 | 129 | "metadata": {}, |
144 | 130 | "source": [ |
145 | | - "Specify a `MONAI_DATA_DIRECTORY` variable, where the data will be downloaded. If not\n", |
146 | | - "specified a temporary directory will be used." |
| 131 | + "## Setup data directory\n", |
| 132 | + "\n", |
| 133 | + "You can specify a directory with the `MONAI_DATA_DIRECTORY` environment variable. \n", |
| 134 | + "This allows you to save results and reuse downloads. \n", |
| 135 | + "If not specified a temporary directory will be used." |
147 | 136 | ] |
148 | 137 | }, |
149 | 138 | { |
|
166 | 155 | "print(root_dir)" |
167 | 156 | ] |
168 | 157 | }, |
| 158 | + { |
| 159 | + "cell_type": "markdown", |
| 160 | + "id": "d49ee071", |
| 161 | + "metadata": {}, |
| 162 | + "source": [ |
| 163 | + "## Set deterministic" |
| 164 | + ] |
| 165 | + }, |
| 166 | + { |
| 167 | + "cell_type": "code", |
| 168 | + "execution_count": null, |
| 169 | + "id": "3b010865", |
| 170 | + "metadata": {}, |
| 171 | + "outputs": [], |
| 172 | + "source": [ |
| 173 | + "set_determinism(42)" |
| 174 | + ] |
| 175 | + }, |
169 | 176 | { |
170 | 177 | "cell_type": "markdown", |
171 | 178 | "id": "049661aa", |
172 | 179 | "metadata": {}, |
173 | 180 | "source": [ |
174 | | - "### Download the training set" |
| 181 | + "## Download the training set" |
175 | 182 | ] |
176 | 183 | }, |
177 | 184 | { |
|
248 | 255 | "id": "d437adbd", |
249 | 256 | "metadata": {}, |
250 | 257 | "source": [ |
251 | | - "### Visualise examples from the training set" |
| 258 | + "## Visualise examples from the training set" |
252 | 259 | ] |
253 | 260 | }, |
254 | 261 | { |
|
282 | 289 | "id": "8c6ca19a", |
283 | 290 | "metadata": {}, |
284 | 291 | "source": [ |
285 | | - "### Download the validation set" |
| 292 | + "## Download the validation set" |
286 | 293 | ] |
287 | 294 | }, |
288 | 295 | { |
|
327 | 334 | "id": "1cfa9906", |
328 | 335 | "metadata": {}, |
329 | 336 | "source": [ |
330 | | - "### Define network, optimizer and losses" |
| 337 | + "## Define network, optimizer and losses" |
331 | 338 | ] |
332 | 339 | }, |
333 | 340 | { |
|
377 | 384 | "id": "331aa4fc", |
378 | 385 | "metadata": {}, |
379 | 386 | "source": [ |
380 | | - "### Model training\n", |
| 387 | + "## Model training\n", |
381 | 388 | "Here, we are training our model for 100 epochs (training time: ~60 minutes)." |
382 | 389 | ] |
383 | 390 | }, |
|
474 | 481 | "id": "ab3f5e08", |
475 | 482 | "metadata": {}, |
476 | 483 | "source": [ |
477 | | - "### Learning curves" |
| 484 | + "## Learning curves" |
478 | 485 | ] |
479 | 486 | }, |
480 | 487 | { |
|
518 | 525 | "id": "e7c7b3b4", |
519 | 526 | "metadata": {}, |
520 | 527 | "source": [ |
521 | | - "### Plotting evolution of reconstructed images" |
| 528 | + "## Plotting evolution of reconstructed images" |
522 | 529 | ] |
523 | 530 | }, |
524 | 531 | { |
|
559 | 566 | "id": "517f51ea", |
560 | 567 | "metadata": {}, |
561 | 568 | "source": [ |
562 | | - "### Plotting the reconstructions from final trained model" |
| 569 | + "## Plotting the reconstructions from final trained model" |
563 | 570 | ] |
564 | 571 | }, |
565 | 572 | { |
|
595 | 602 | "id": "222c56d3", |
596 | 603 | "metadata": {}, |
597 | 604 | "source": [ |
598 | | - "### Cleanup data directory\n", |
| 605 | + "## Cleanup data directory\n", |
599 | 606 | "\n", |
600 | 607 | "Remove directory if a temporary was used." |
601 | 608 | ] |
|
0 commit comments