Docsity

Deep Learning for Medical Imaging summary, Appunti di Tecniche Di Intelligenza Artificiale

Toggle sidebar
bg1
Side 1
Deep Learning for Medical Imaging
1. Introduction – ML
1.1. ML for Image Processing
We need a lot of information from the images: segmentation, registration, diagnostics. The
images have many variations and complexity èno analytical solution. For this, the ML helps
as a solution to these problems.
The algorithm does the image processing, from which we get information. This information
gave restrictions on the ML, etc. From the processing we get a feature and can segment the
image to define areas.
Supervised learning is divided into generative (determining distribution behind the data)
and discriminative (only division relevant) models. There is no general answeras to when
one is the better choice over theother
• Interference easier with discriminatory models
• Image data very high-dimensional costly modelingè
• Information to be created based on data generationè Generative
• Missing data in Training/Test è Generative
• Prior knowledge as Prior è Generative
1.2. Discriminative
From data x, close state y. Discrete space = classification, continuous space =
regression. For the solution we have:
• Model = mathematical relationship between x and y
• Learning algorithm = Adjusting the parameters given to the training examples
• Interference algorithm = Take new point x and use the model to get to y
Problem: Overfitting. Therefore, the performance on a
test set is important with evaluation by a loss function.
But minimizing the risk alone is not enough to è make
regularization sterm important. Big regulator = believe
more in regulator, smaller = believe more in data +
risk.
1.3. Empirical risk minimization
• Performance is measured by a loss function
• Important: Model must be able to generalize (optimization important here)
• Therefore, overfitting should be prevented by punishment of a complex model
For this, two ways: Engineering path = Choose loss and regulator based on the problem.
Optimization path = ERM can be turned into convex problem a lot of èpotential.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31

Anteprima parziale del testo

Scarica Deep Learning for Medical Imaging summary e più Appunti in PDF di Tecniche Di Intelligenza Artificiale solo su Docsity!

Side 1

Deep Learning for Medical Imaging

1. Introduction – ML

1.1. ML for Image Processing

We need a lot of information from the images: segmentation, registration, diagnostics. The images have many variations and complexity èno analytical solution. For this, the ML helps as a solution to these problems.

The algorithm does the image processing, from which we get information. This information gave restrictions on the ML, etc. From the processing we get a feature and can segment the image to define areas.

Supervised learning is divided into generative (determining distribution behind the data) and discriminative (only division relevant) models. There is no general answeras to when one is the better choice over theother

  • Interference easier with discriminatory models
  • Image data very high-dimensional costly modelingè
  • Information to be created based on data generationè Generative
  • Missing data in Training/Test è Generative
  • Prior knowledge as Prior è Generative

1.2. Discriminative

From data x, close state y. Discrete space = classification, continuous space = regression. For the solution we have:

  • Model = mathematical relationship between x and y
  • Learning algorithm = Adjusting the parameters given to the training examples
  • Interference algorithm = Take new point x and use the model to get to y

Problem : Overfitting. Therefore, the performance on a test set is important with evaluation by a loss function. But minimizing the risk alone is not enough to è make regularization sterm important. Big regulator = believe more in regulator, smaller = believe more in data + risk.

1.3. Empirical risk minimization

  • Performance is measured by a loss function
  • Important : Model must be able to generalize (optimization important here)
  • Therefore, overfitting should be prevented by punishment of a complex model

For this, two ways: Engineering path = Choose loss and regulator based on the problem. Optimization path = ERM can be turned into convex problem a lot of èpotential.

Side 2

1.3.1. Convex functions

Important convex functions are negative entropy, non-normalized negative entropy, and hinge loss. In the case of convex sets, parts of it can be viewed with slicing (quasi-convex).

In order to ensure convex behavior, one does:

Mengenoperationen

  • Intersection of convex sets
  • Image of the convex set under linear transf.
  • Inv. Image of a convex set under linear transf.

Funktionsoperationen

  • Linear combination with non-negative weights
  • Punktweises Maximum
  • Projection along one direction
  • Composition with affine function

1.4. First derivation

The Taylor series development 1st order can be considered as a global lower limit of a function. This allows the minimum to be determined. However, if the function is not smooth and has angular transitions, subgradients are used. These exist even in non-differentiable places. Important feature: A convex function is at least subdifferentiable everywhere.

1.5. Lineare SVM

Here, the maximum non-binding hyper-separation line is maximized. This works well with linearly separable data. In general, however, the data is not always exactly linearly separable. Therefore, Slack variables are used and allow the margin to be exceeded.

However, since the Slack variables can go against infinity otherwise, a regulation is inserted. As a result, a good classification is found and one is willing to pay the price for the others.

The condition can be changed to Xi and inserted into the main condition. This gives you a similar optimization trick as with the Hingeloss (max(0.1-x)).

To select the loss function you can use the binary loss. However, this is non-convex,which is why a convex upper limit can be used (hinge).

1.6. Cutting plane method

We want to localize our function. For this we have our model, which can calculate a function value and the gradient for each given point and a lower limit of the function. Importantly, Taylor has a global lower limit for our function. Through the tangents, we know where our function does not run along. Lowest intersection = new lower limit.

Side 4

The disappearing gradient occurs because the further we do the backpropagation, the smaller the changes become. The changes should be large at best, but become less from layer to layer to the front. As a result, the neurons in the first layers learn much more slowly than the neurons of later layers. The product from many such derivative stermes reduces the product exponentially. Especially with Sigmoid, where the maximum of the derivative is 0.25.

2.3.3. ReLU

ReLU has the property that it can prevent the disappearing gradient.max(0,x) and the derivation leads to constant learning. As a result, it can achieve a very good regularization in comparison. The learning success can be seen in the respective layers.

2.4. CNN

Here we exploit a convolutional matrix that focuses only on certain information for our given matrix and can extract it.

Furthermore, nonlinearities are used and max-pooling allows the size of the layers to be redefined.

2.5. Generative Models

We are interested here in the distributions of the class. Bayes is used for this and we look at all possible cases under assumptionsas to how data can be generated from it. Assumptions that cover multiple paths that are consistent with the data are more plausible and appropriate.

The predictions can be all possible values. Every decision closes one of these paths. The data can be many cases. Each observation closes one of these possible cases.

2.5.1. Expiration

  1. Design the model (Based on data)
  2. Determine the conditions of the data (update)
  3. Evaluate the model (critique)

And start again at 1., until evaluation satisfied.

2.5.2. Example

We know that there are 4 balls in one pocket. They can be either blue or white. The assumption is 3 white and 1 blue. We observe that the first draw is blue. So the others can be white. After that, we draw a white ball and expand our model accordingly at all nodes according to our assumption. Given the observed data, only a few paths are possible, rest can be eliminated.

Subsequently, the paths of the possible cases are determined. Representations are normalized to probabilities, because better representation.

Side 5

2.5.3. Modellerstellung

Design the model based on the given data. Bayes then converts the prior information to posterior-W. The order of the data does not matter, as the model is not yet relevant to it. Each posterior-W is a prior for the next observation and vice versa.

But Bayes is only optimal for the model, not for theworld. Therefore, the model must be monitored, as errors can occur.

  • Errors in the calculations o Calculations must always be checked
  • Deviations between model and reality o Are important differences between the model and reality, then there is no logical guarantee that it can be applied all over the world
  • Fehlleitende Samples (Bias) o Any wrong sample of the data can still lead in the wrong direction

3.3.2. Results

As a metric they often used the Area under curve-Score (AUC). In comparison with dermatologists NN differ in their result. If there are cases where its difficult to classify the case, the programmer can use a case differentiation to classify it to one class and do further investigations. A NN must ŐĞŶĞƌĂůŝnjĞǁĞůůĂŶĚĚŽĞƐŶ͛ƚĚŝĨĨĞƌƚŚĞƐĂŵĞ as a doctor has the possibility to.

4. Deep Learning for Computer Assisted Intervention (CAI)

4.1. What is CAI?

CAI is a field of research and practice, where medical interventions (=Eingriffe/Maßnahmen) are supported by computerbased tools and methodologies. It got more popular because the operations are moving from an open standard to a closed (minimalinvasiv) one.

Well known venues are MICCAI , CARS (Computer Assisted Radiology and Surgery). Some journals are International Journal of CARS , Medical Image Analysis , and IEEE Transactions on Medical Imaging.

CAI is used in a huge variety of fields like

x Localization (instruments, patients) x Planning (of interventions, invasive) x Simulation and training system x Robotics x Clinical evaluation

Furthermore, its used for many kinds of intervention like

x Neuro x Orthopaedic x Spinal x Cardiovascular x Thoracic

Specifications

x Time-constraint : AI must be efficient. It must fulfill the job as fast as possible and ĚŽĞƐŶ͛ƚ make mistakes. x Knowledge of procedural data: The generalization of data must be known x Dynamic or environment : AI must be robust for its usage in a dynamic situation. Not every patient has the same conditions x FLEXIBILITY : o Missing input data: not all kind of sensors are being used continuously. AI must be flexible in these situations o Online and continuous learning: important for the property of being robust o Uncertainty handling: BIG DEAL o Risk aversion: a false decision could lead to the death of the patient

4.2. Different approaches

4.2.1. I3PosNet: Pose Estimation for surgical instruments

The motivation is coming from the idea of a navigation for minimally invasive procedures. They use flexible instruments with non-linear paths. The big difference between an open and minimally invasive procedure is the view. The minimally invasive approach has no line-of-sight on the surroundings.

Here we use two kinds of data: CAD models ( simulations ) and real x-ray images. We mix the real data with the simulations (= Domain adaption/shift). With this we can reach better results instead of using only one. Otherwise, the NN would perform bad on real data.

Design (pose estimation and end-to-end)

x Using a custom loss function for individual contributions form translation, orientation, and image projection o Often seen in papers: custom loss functions x CNN has 5 convolutions, 2 fully connections, ReLU x Stochastic gradient descent x Xavier initialization

4.2.3. U-Net for recognition and pose estimation

The process of automization/assistance/visualizations requires the instrument pose. It allows the flexibility of gear and robotic manipulation amplification.

An example of reality is the daVinci Surgical Robot. The image is RGB a has manually annotated circles with joint positions. The annotations of the tool positions are calculated with a probabilistic map (one per tool, one per joint).

x Combine the recognition and pose estimation into a single step/network (end-to-end network) x Full problem ( where is which tool ) Î use probability maps for each tool and joint x Decompose to tool classification and pose estimation o Recognition is Classification (is there a tool of type m) ܲ ሺܶ (^) ௠ሻ o Pose with probability map (where is the joint n of Tool m) ܲ ሺܬ௠^ ௡^ ȁܶ (^) ௠ሻ o Using independence:

ܲ^ ሺܶ^ ଵǡ ǥ ǡ ܶெǡ ܬଵ^ ଵǡ ǥ ܬଵ^ ேǡ ǥ ܬெ^ ଵ^ ǡ ǥ ǡ ܬெ^ ேሻ^ ൌ ෑ ܲ ሺ ܶ௠ሻ

௠ ෑ ෑ ܲ ሺܬ௠^ ௡^ ȁܶ (^) ௠ሻ

௠ ௡

o As the loss function, we use the cross entropy. Because the prediction and ground truth will coincide o The cross entropy is a measure for the quality of a probabilistic model x CNN design: 5 convolutions, 5 deconvolutions (U-shape)

5. Surgical Process Modeling (SPM)

5.1. Definition

The computer-assisted surgery represents a new type of generation for surgeries. It helps the transition from open surgeries to computer-assisted, minimal invasive operations. Besides that, it also helps in the field of quantize analysis and the understanding what is really happening. SPM offers a unique way to quantize and evaluate surgeries.

There are many different applications :

x The Education of surgeons x The planning of a surgery x Situation awareness: what is happening x Efficiency and quality of care

The field of SPM can be differentiated in 5 fields: Modelling, Acquisition of Data, Analysis , Application and Validation-Evaluation. But SPM is represented primally in the analysis-field. The most applications are in endoscopic-laparoscopic surgery and Neurosurgery and is often an intra-operative assistance and evaluation of tools/systems.

5.2. Laparoscopic Cholecystectomy

This is the go-to example because this surgery has the most development for robotics and imaging. The old ways used a multidimensional time series for the tool presence signals which where used. For the presence they used a Hidden Markov Model (no deep learning) to elaborate the timestamp of the surgery. The usage of the tools by the surgeons is highly related with the phase of the surgery.

Summary (take home)

x Presence of Surgical tools highly related with phase x Tools are physical representation of the functions performed by surgeons

5.3. Surgical tool presence detection

There are many problems in the detection of the tools:

x Lighting x Changes of perspective x No equal distribution of showing the tool (some were always used, other not)

In competition you always must have Sampling, Architecture and Smoothing

5.3.1. Label imbalance

x The Imbalance ratio per label (IRpL) measures individual label imbalance

ܮ݌ܴܫ ሺܶ^ ௜ሻ^ ൌ

x = 1.0 for the majority (häufigstes) label, > 1.0 for other labels

Take home message

x Although, we can use CNN off the shelf, but we must not disregard the basic ML assumptions. x Understanding of the problem can help in better model formulation. o E.g., ZIBNet design for endoscopic videos. x Ensemble always triumphs in competitions

6. Medical Image Segmentation

6.1. Introduction

Each Pixel has a Label. They can be summarized as regions with different rules:

  1. ׫௜^ ௡ୀ^ ଵܴ ௜ ൌ ܴ (completeness)
  2. ܴ ௜ is a connected set
  3. ܴ ௜ ת ܴ ௝ ĚŽŶ͛ƚŚĂǀĞĂƉŽŝŶƚƚŚĞLJƐŚĂƌĞ
  4. ܳ ሺܴ (^) ௜ሻ ൌ ݁ݑݎݐ
  5. Ri with Rj is false for any adjacent regions

Segmentation helps in different medical fields:

x Visualization x Planning (input - > Segmentation - > 3D Model Extraction - > Trajectory Planning x Monitoring o i.e., Volume and Shape of an organ x Variation of Organs, computational anatomy, functional MRI/CT

There are many quality metrics to consider: First the metric about the Model to Ground Truth

x Dice coefficient: ܥ஽௜௖௘ ൌ ଶ ȁሺ௉ȁ௉ȁାתȁொொȁȁሻ ൌ (^) ଶ் ௉ ାଶ்^ ௉ி௉ାிே x Jaccard coefficient: ܥ௃௔௖௖௔௥ௗ ൌ ȁ ȁ௉௉ת׫ொொȁȁ (Oversegmentation to Undersegmentation)

x Volume overlap: ܥை௩௘௥௟௔௣ ൌ (^) ୪୬ȁሺ௉ȁ௉תȁொǡȁொȁȁሻ

Distance to surface:

x Mean surface distance (Chamfer distance): ݀ ሺܭǡ ܮሻ^ ൌ ଵ ௡ σ^ ௡ ௟ୀଵ‹หȁܭሺ݇^ ሻ^ െ ܮሺ݈^ ሻȁห x Mean symmetric surface distance: ݀ ሺܭǡ ܮሻ ൌ ௗሺ௄ǡ௅ሻା ଶௗሺ௅ǡ௄ሻ x Hausdorff distance: ݀ ுሺܺ ǡ ܻ ሻ ൌ ƒšሼ•—’ ௫א௑ ௬^ ‹ˆא௒ ݀ ሺݔǡ^ ݕሻ^ ǡ^ •—’ ௬א௒ ௫^ ‹ˆא௑ ݀ ሺݔǡ^ ݕሻሽ

But metrics are not good alone because they are objective and quantitative- not qualitative

6.1.1. Challenges in Medical Imaging

Automated Cardiac Diagnosis

Segment ventricular endo-/epicardium, classify heart. To improve computerized cardiac analysis

Brain Tumor Segmentation

Segmentation of brain tumors, predict overall survival, uncertainty segmentation. To detect, monitoring and analysis

Thoracic Organs at Risk in CT Images

Organs at risk segmentation, lung cancer. To radiation therapy planning

COVID-19-20 Segment lung lesions of COVID-19. Detect pulmonary embolism

Artefact detection in video endoscopy

Artefact detection with localization and labeling. Region segmentation for precise boundary. Diagnosis and treatment in hollow organs

Pre-processing

x Cropping: remove all unnecessary input e.g. Air x Resampling: resample all image to the median spacing x Normalization: based in dataset statistics + clip for [0.5, 99.5] percentiles x Data-augmentations: Rotation, scaling, elastic deformations, gamma correction and flips

Loss

x ܮ௧௢௧௔௟ ൌ ܮௗ௜௖௘ ൅ ܮ஼ா (Cross-Entropy not well for borders, Dice better)

Postprocessing

x Only use the largest connected component and remove all others

Cascade

x min. 4 times more input voxels as can be processed form the 3D Unet=> use a 2D Unet x Feed the output of 2D Unet as additional input to the 3D Unet, but erode/dilate segmentation randomly

6.2.4. Attention

Convolutions encode translation invariance Î efficiency and scalability. Major problem : the receptive field depends on kernel size and number of convolutional layers Î Convolutions are locality sensitive and lack global understanding.

Why Transformer? Efficient and Self-Attention is a simple and scalable way to learn the inductive biases. Problem with that: very expensive for high dimensional inputs

Self-Attention

x Basic Building Block of Transformers x Build 3 distinct representations x Then use the equation: ݊݋݅ݐ݊݁ݐݐܣ ሺܳ ǡ ܭǡ ܸ ሻ ൌ ݔܽ݉ݐ݂݋ݏ ൬ொ௄

೅ ඥௗೖ^ ൰^ ݒ x Multiple times, different Blocks

6.2.5. Transformer

x Use multiple Transformer Blocks o Multi-ŚĞĂĚƚƚĞŶƚŝŽŶ͕EŽƌŵĂůŝnjĂƚŝŽŶ>ĂLJĞƌƐĂŶĚD>W͛Ɛ x Transformer scale very well for large amounts of data, but quadratic in the input length n. o For an Image n = H x W! x Vision Transformer: picture is divided in patches o Transformer says, where the patch does belong o Only cares about global context Î Lacks local details for segmentation x Î Swin Transformer build hierarchical feature map o Transfer learning possible but maybe not totally usable

6.3. Shape regularization

x For preoperative planning x For 3D printing x Problem: CNNs do pixelwise segmentation o Counter-measures: o CRFs (still pixelwise) o Post processing (graph cut, ASM, etc..)

6.3.1. Active shape model (ASM)

x ASM = Statistical Shape Model (SSM) + Appearance Model (AM) x SSM: landmark vector describes the organ x AM: learn an appearance (local gradient) at each point of a landmark vector

6.4. Q&A

x Steps/border Î Augmentation for training (Random fields/Markov fields) x Transformer biggest potential in the feature (when trained in different domains)

7.2.4. Out-of-distribution Uncertainty

You evaluate the model on out-of-distribution (OOD) inputs which do not belong to any of the existing classes. This shows if the confidence of i.i.d. inputs is bigger than o.o.d. inputs.

Some measurements are Max confidence or the Entropy

ImageNet-C

Typically we assume training and test are i.i.d. from the same distribution. In practice, this rule is often violated for test data and distributions shift. In ImageNet-C you vary the input by simulate different types of corruption with varying intensity

7.2.5. Measure the quality of Uncertainty

Calibration measures how well predicted confidence (probability of correctness) aligns with the observed accuracy. From this graph you can calculate the Expected Calibration Error (ECE):

x Computed as the average gap between accuracy and predicted probability for S buckets (bar) x ŽĞƐŶŽƚƌĞĨůĞĐƚ͞ƌĞĨŝŶĞŵĞŶƚ͟ x Varies depending on bucket (bar) size

Negative Log-Likelihood (NLL)

x Can overemphasize tail probabilities (= rare cases)

Brier Score:

x Quadratic penalty (bounded range [0,1] unlike log) x Inadequate for very rare or very frequent events

7.3. Uncertainty for Classification

In Bayesian learning we appeal to approximate posterior inference

  1. Specify likelihood (neural net & output distribution) and prior
  2. Choose approximate inference procedure (Ensembles, MCMC)
  3. At test time, average predictions analytically or using samples form posterior

7.3.1. Bayesian Networks

Idea: learn distributions over the parameters. We need a prior and a family of distributions to approximate the true posterior.

But Variational Inference occurs and turns inference into optimization. The variational parameters v has to be fit to be close (in Kullback-Leibler) to the exact posterior. Take gradients for SGD of the loss. The negative loss is the evidence lower bound of the log-Likelihood of the posterior.

The standard Neural Networks are Overconfident Î fail silently.

Pitfalls of Bayesian Neural Networks

^ƚĂŶĚĂƌĚŶŽƌŵĂůƉƌŝŽƌŝƐƚŚĞĚĞĨĂƵůƚ͘Ƶƚŝƚ͛ƐŶŽƚ great:

x Bad statistical properties o ĚŽĞƐŶ͛ƚƵƐĞŝŶĨŽƌŵĂƚŝŽŶĂďŽƵƚƚŚĞŶĞƚǁŽƌŬƐƚƌƵĐƚƵƌĞ͕ƵŶŝƚ - wise or layer-wise o the more data, all hidden units contribute infinitesimally to each input o not clear, how to improve the prior for specific properties x It has bad optimization properties o Sensitive to parameterization o Too strong a regularizer. The gradient signal of prior dominates o Cold posterior effect = sharpe the posterior for better results by T

7.3.2. Monte Carlo Dropout

Idea: Use Dropout during Inference

Similar to using a Bernoulli prior in BNN

x Very simple to use x No extra parameters x Easy to fool

7.3.3. Temperature Scaling

Idea: modify softmax probabilities post-hoc

  1. Parameterize Softmax output layer with T

݌ሺݕ௜ȁݔሻ ൌ

‡š’ ቀݖܶ௜^ ቁ

σ ‡š’ ቀ

௝

  1. KƉƚŝŵŝnjĞdŽŶĂƐĞƉĂƌĂƚĞ͞ƌĞ - calibratioŶ͟ĚĂƚĂƐĞƚ a. For each set, must do b. Dataset besides Train-Test-Sets c. Performance loss possible

7.3.4. Deep Ensembles

Ensembles are consistently among the best performing methods, especially under dataset shift.

Loss Landscape

Variational Bayesian methods are effective at averaging uncertainty within a single mode , but fail to explore the diversity of multiple modes

x Variational methods capture local uncertainty around a mode x Ensembles identify different modes but ignore local uncertainty and might not pick the best point for each mode x Different modes diverge over time through different trajectories x Model moves a long one possible way Î different models with different results possible