Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
542 changes: 271 additions & 271 deletions chapters/1-1.ipynb

Large diffs are not rendered by default.

1,016 changes: 507 additions & 509 deletions chapters/1-2.ipynb

Large diffs are not rendered by default.

508 changes: 257 additions & 251 deletions chapters/1-4.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions chapters/11A.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{
"cell_type": "markdown",
"source": [
"# Inference in AI/ML:"
"## **Inference in AI/ML**"
],
"metadata": {
"id": "Zdkyf97QSghd"
Expand All @@ -46,7 +46,7 @@
{
"cell_type": "markdown",
"source": [
"## Difference between training and inference."
"### **Difference between training and inference.**"
],
"metadata": {
"id": "THKGYDJVTUrI"
Expand Down Expand Up @@ -82,7 +82,7 @@
{
"cell_type": "markdown",
"source": [
"###Inference: Using the deep learning model"
"### **Inference: Using the deep learning model**"
],
"metadata": {
"id": "i8GdGUetkwJC"
Expand All @@ -100,7 +100,7 @@
{
"cell_type": "markdown",
"source": [
"### Comparison of training and inference in terms of time :"
"### **Comparison of training and inference in terms of time :**"
],
"metadata": {
"id": "2oWQzc-uJpha"
Expand All @@ -124,7 +124,7 @@
{
"cell_type": "markdown",
"source": [
"##Data preprocessing and transformation for inference"
"### **Data preprocessing and transformation for inference**"
],
"metadata": {
"id": "doKuhtauJ95r"
Expand All @@ -133,7 +133,7 @@
{
"cell_type": "markdown",
"source": [
"###Preprocessing:\n",
"### **Preprocessing:**\n",
"It is crucial to understand the limitations of inference. First, the input data must be of the same nature as used during training. For example, a trained network used for brain tumor classification on axial brain MRI slices cannot be used for inference on axial brain CT slices, or even sagittal brain MRI slices. It may even require precisely the same slice thickness or even device manufacturer to work well. When an algorithm is overly sensitive to the nature of the data, it is often called 'brittle' and it is not generalized.\n",
"Second, it is crucial to understand that a preprocessing pipeline applied to training data must also be applied to inference data. As an example, consider diagnosing Alzheimer's Disease (AD) using MRI. In most cases, people use a preprocessing pipeline that includes skull stripping (zeroing out non-brain tissues), reorientation to a consistent image plane, bias field correction, and intensity normalization. Because the model was only exposed to preprocessed data during training, the model will not perform well if inference data is not handled in the same way.\n",
"\n"
Expand All @@ -145,7 +145,7 @@
{
"cell_type": "markdown",
"source": [
"###Transformation:\n",
"### **Transformation:**\n",
"Data transformation includes a number of different manipulations that alter its properties, but hopefully in a way that preserves the key information. Some transformations alter the size of pixels and thus also the X, Y and Z dimensions. Since MRIs may be acquired with a variety of different pixel sizes and X, Y, and Z dimensions, it is usually a good thing to normalize the size to be consistent prior to using the data for training or inference. \n",
"Another family of transformations alters intensity. Sometimes this is to set the grayscale range to be similar for all images. In some cases, we may wish to filter images to reduce noise. \n",
"Another class of spatial transformations alters the primary plane of the images, for instance from Axial to Coronal or sagittal. \n",
Expand Down Expand Up @@ -200,7 +200,7 @@
{
"cell_type": "markdown",
"source": [
"##Inference with torch.no_grad and eval() mode:\n",
"### **Inference with torch.no_grad and eval() mode:**\n",
"\n",
"PyTorch's model instance has two modes: train and eval: model.train() is for training, and model.eval() is for evaluation which requires inference. The difference is that model.eval() allows the batchnorm or dropout layers to run in evaluate mode rather than training mode. In training mode, dropout is active and, as a result, in every pass, some nodes or weights will be set off randomly. In eval mode, the dropout is off and, based on the trained network, some nodes are on and others are off.\n",
"Occasionally, for uncertainty quantification, one will want to leave the dropout on in inference, but it is beyond the scope of this chapter, and we will discuss that in the future.\n",
Expand Down Expand Up @@ -238,7 +238,7 @@
{
"cell_type": "markdown",
"source": [
"##Using visualization techniques to check the model:\n",
"### **Using visualization techniques to check the model:**\n",
"When we train a model and later use it for inference, we can check it to see if it is looking at the correct features or parts of an image. This will enable us to detect potential biases or other errors. This is covered in chapter 10C ([Model Interpretation and Visualization Techniques\n",
"Validation of MIDeL algorithms](https://)).\n",
"\n"
Expand Down
398 changes: 203 additions & 195 deletions chapters/13A.ipynb

Large diffs are not rendered by default.

Loading
Loading