How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King...

48
How to Get Started in AI Brian Anderson, MS

Transcript of How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King...

Page 1: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

How to Get Started in AIBrian Anderson, MS

Page 2: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

For running on your own

• Go to google colab in a chrome browser• https://colab.research.google.com/notebooks/intro.ipynb

• Click ‘File’ -> ‘open notebook’• Click ‘GitHub’ tab and search brianmanderson

• Select the Repository Imaging_Physics_Workshop_1_28_20• Click ‘Click_Me.ipynb’

• Follow instructions to change Runtime to GPU

• All packages at www.github.com/brianmanderson

Page 3: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Overview

• Machine\Deep learning in imaging• Convolutions!

• Difference between deep and machine learning

• Creating data from medical images (provided)

• Things I wish I’d known

Page 4: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Imaging (Convolution Nets)Machine\Deep Learning Style

Page 5: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

‘Main parts’ of convolution network

• Convolution kernels• Activation

• Pooling Layers

• Fully-Connected Layers

https://neurohive.io/en/popular-networks/vgg16/

Page 6: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

What is a convolution?

Kernels

This is a box!

Two horizontal and two parallel lines

Convolution Activation Max Pooling Fully Connected

Page 7: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Kernels

This is a box!

What is a convolution?

Convolution Activation Max Pooling Fully Connected

Page 8: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

What is a convolution?

Kernels

This is a box!

Convolution Activation Max Pooling Fully Connected

Page 9: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Activation

Convolution Activation Max Pooling Fully Connected

Page 10: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Horizontal and Vertical…

Convolution Activation Max Pooling Fully Connected

Page 11: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Max PoolingMax value in a 2x2 region

Convolution Activation Max Pooling Fully Connected

Page 12: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Max PoolingMax value in a 2x2 region

Convolution Activation Max Pooling Fully Connected

Page 13: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Max PoolingMax value in a 2x2 region

Convolution Activation Max Pooling Fully Connected

Page 14: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Max PoolingMax value in a 2x2 region

Convolution Activation Max Pooling Fully Connected

Page 15: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Fully Connected

• “Lay” the voxels out Input layer Output

Elephant!

Convolution Activation Max Pooling Fully Connected

Page 16: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Low specificity..

Also has two parallel lines…

Add four more kernels

Page 17: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

(Finally) Deep learning

• Who knows what kernels are needed!

• Why can’t the stupid computer figure it out…

Page 18: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

First workshop – DeepBox

Page 19: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

What’s the difference for deep learning?

• We don’t set the kernels Random initialization

Conv6

4x6

4

1 4

Input

FC (2 classes)

Output

How does it learn?

Page 20: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Backpropagation!

Conv6

4x6

4

1 4

Input

Output

Wrong output?Change the decisions before it!

0.60.4

Page 21: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Comparison

Machine learning• Easy to understand kernels

• Have to be clever…

Deep learning• Difficult to understand kernels

• Works great!

• Have to think about use cases• (Would a triangle be predicted as

a rectangle or circle?)

Page 22: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Comparison

Machine learning• Easy to understand kernels

• Have to be clever…

Deep learning• Difficult to understand kernels

• Works great!

• Have to think about use cases• (Would a triangle be predicted as

a rectangle or circle?)

Page 23: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Specifically into deep learning

Page 24: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Quick overview

32x32 image

5x5 kernel

28x28 feature maps

EarsFeet

Fur

Pool Pool

Max pooling

Problem: Convolutions are locally dependent..

26

Cat

Page 25: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Auto-encoder/Decoder

Page 26: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Second workshop – Liver model

Page 27: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Biggest time sinks..

• Data curation!

Roi names: Liver, liver, liver_bma, liver_9.15.10, etc.

Page 28: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Data Curation workbook

Page 29: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Now…

What about pre-trained?

Regular UNet

Page 30: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Liver ModelWorkshop

Page 31: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Visual Geometry Group (VGG)

Source Information

Image Distribution

Source Training Validation Test

ImageNet 1,200,000 50,000 150,000

http://www.image-net.org/synset?wnid=n02977438

~ 1000 images in 1000 classes

ImageNet~15 million, 22,000 categories

Page 32: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Visual Geometry Group (VGG)

Cat

https://neurohive.io/en/popular-networks/vgg16/

Page 33: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Visual Geometry Group (VGG)

Goal

https://neurohive.io/en/popular-networks/vgg16/

Page 34: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Nuances of fine-tuning: what to re-train

Propagated loss undoes pre-training

Protect these layers

VGG Pretrained New

Train

Training will first be bad..All of ‘New’ is initialized random weights

Page 35: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Outputs

block1_conv1

Output

block1_conv1_activation

Page 36: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Nuances of fine-tuning: what to re-train

What’s best?

Page 37: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Making your own architecture

Page 38: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Optimization Searching

• Things you can change…

• Architecture• Layers deep

• # Convolution blocks/# Features

• Hyper-Parameters• Learning rate, loss, regularization

Start simple…

Page 39: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Finding a good learning rate

https://www.pyimagesearch.com/2019/08/05/keras-learning-rate-finder/

• Potentially largest wastes of time…

• Gradually increase LR• Find min and max LR

https://arxiv.org/pdf/1506.01186.pdf

Min Learning Rate

Max Learning Rate

Min LR

Max LR

Triangular Policy

https://github.com/brianmanderson/Finding_Optimization_Parameters

Page 40: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Inverse Transpose Artifacts

Page 41: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Important questions to ask

Page 42: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

• Evaluating final algorithm• Using same loss as before? Dice?

• What is your loss metric?• Dice, Categorical cross entropy

Important questions to ask51%

51%

DSC = 1!

Doesn’t mean Dice is bad!Need other metrics with it

Page 43: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Important questions to ask

2 ClassesBoatNot-Boat

https://en.wikipedia.org/wiki/Oceanhttps://www.amazon.co.uk/Tolo-Toys-First-Friends-Dingy/dp/B008PO666U

Page 44: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

• Evaluating final algorithm• Using same loss as before? Dice?

• What is your loss metric?• Dice, Categorical cross entropy

• WITHHELD TEST SET?!

• Qualitative assessment?

Important questions to ask51%

51%

DSC = 1!

Doesn’t mean Dice is bad!Need other metrics with it

Training Validation Test

Page 45: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Oops

• Accuracy: 0.92

• Prediction

Page 46: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

• Evaluating final algorithm• Using same loss as before? Dice?

• What is your loss metric?• Dice, Categorical cross entropy

• WITHHELD TEST SET?!

• Qualitative assessment?

• What optimizer are you using?• Adam, SGD, (maybe RAdam)

Important questions to ask51%

51%

DSC = 1!

Doesn’t mean Dice is bad!Need other metrics with it

Training Validation Test

Page 47: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

Acknowledgements and Thanks

49

Laurence Court, PhD

Kelly Kisling, MS

Carlos Cardenas, PhD

Tucker Netherton, DMP

Rachel McCarroll, PhD

Jinzhong Yang, PhD

Luciano Branco

Brock Lab Group

Kristy Brock, PhD

Molly McCulloch

Guillaume Cazoulat, PhD

Bastien Rigaud

Yulun He

Andrea Ohrt, MBA

Alexandra Ford

Jason King

Anando Sen, PhD

Anne-Cecile Lesage, PhD

Odisio Lab Group

Bruno Odisio, MD

Ethan Lin, MD

Eugene Koay, MD

*undecided

Rachel Ger

Skylar Gay

Casey Gay

Joy Zhang, PhD

Callistus Nguyen, PhD

Constance Owens

Dong Joo Rhee, MS

Yvonne Roed, PhD

Court Yard Group

Thank you!

Committee

Kristy Brock, PhD

Laurence E Court, PhD

Erik N.K. Cressman, MD, PhD

Ankit B Patel, PhD

Carlos C Cardenas, [email protected]

www.Github.com/BrianMAnderson

Page 48: How to Get Started in AI - MD Anderson Cancer Center...Andrea Ohrt, MBA Alexandra Ford Jason King Anando Sen, PhD Anne-Cecile Lesage, PhD Odisio Lab Group Bruno Odisio, MD Ethan Lin,

• https://media.giphy.com/media/st83jeYy9L6Bq/giphy.gif (peter throwing blinds ‘tweaking neural network’)

• https://www.youtube.com/watch?v=bnJ8UpvdTQY (kid can’t say animal names)