Top Banner
Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing, Indiana University
27

Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Aug 09, 2018

Download

Documents

phambao
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

ConvolutionalNeuralNetworks

YuzhenYeSchoolofInformaticsandComputing,IndianaUniversity

Page 2: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Contents

• CNNbasics• CNNforvisualrecognition(toexplaintheconceptofconvolution)• CNNforbioinformatics

Page 3: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

ABeginner'sGuideToUnderstandingCNN• NeuralNetworkswithConvolutionlayers

Ref1:http://cs231n.stanford.eduRef2:https://adeshpande3.github.io/adeshpande3.github.io/A-Beginner%27s-Guide-To-Understanding-Convolutional-Neural-Networks/

Page 4: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,
Page 5: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

MovingAverageIn2D

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 0 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 0 0 0 0 0 0 0

0 0 90 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 10 20 30 30 30 20 10

0 20 40 60 60 60 40 20

0 30 60 90 90 90 60 30

0 30 50 80 80 90 60 30

0 30 50 80 80 90 60 30

0 20 30 50 50 60 40 20

10 20 30 30 30 30 20 10

10 10 10 0 0 0 0 0

5Slidecredit:SteveSeitz

],[ yxf ],[ yxg

Page 6: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

CorrelationfilteringSaytheaveragingwindowsizeis2k+1x2k+1:

Loopoverallpixelsinneighborhoodaroundimagepixelf[i,j]

Attributeuniformweighttoeachpixel

Nowgeneralizetoallowdifferentweightsdependingonneighboringpixel’srelativeposition:

Non-uniformweights

6SlideadaptedfromKristenGrauman

Page 7: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Correlationfiltering

Filteringanimage:replaceeachpixelwithalinearcombinationofitsneighbors.

Thefilter“kernel”or“mask”h[u,v]istheprescriptionfortheweightsinthelinearcombination.

Thisiscalledcross-correlation,denoted

7Slidecredit:MichaelS.Ryoo

Page 8: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

],[ yxf ],[ yxg

Averagingfilter• Whatvaluesbelonginthekernelh forthemovingaverageexample?

0 10 20 30 30

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 0 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 0 0 0 0 0 0 0

0 0 90 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

111111111

“boxfilter”

?

8Slidecredit:MichaelS.Ryoo

],[ vuh

Page 9: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

• Whatifwewantnearestneighboringpixelstohavethemostinfluenceontheoutput?

• Removeshigh-frequencycomponentsfromtheimage(“low-passfilter”).

Gaussianfilter

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 0 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 0 0 0 0 0 0 0

0 0 90 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

1 2 1

2 4 2

1 2 1

This kernel is an approximation of a 2d Gaussian function:

9Slidecredit:SteveSeitz

],[ yxf

],[ vuh

Page 10: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

f

h

Convolution• Convolutionisasimplemathematicaloperationwhichisfundamentaltomanycommonimageprocessingoperators.

• Convolutionisperformedbyslidingthekernelovertheimage,generallystartingatthetopleftcorner,soastomovethekernelthroughallthepositionswherethekernelfitsentirelywithintheboundariesoftheimage.

• Convolution:• Flipthefilterinbothdimensions(bottomtotop,righttoleft)• Thenapplycross-correlation

Notationforconvolutionoperator

10Slidecredit:MichaelS.Ryoo

Page 11: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Convolutionvs.correlationConvolution

Cross-correlation

11SlideadaptedfromKristenGrauman

Page 12: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Derivativesandedges

imageintensity function

(along horizontal scanline) first derivative

edges correspond toextrema of derivative

An edge is a place of rapid change in the image intensity function.

12Slidecredit:SvetlanaLazebnik

Page 13: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

DerivativeswithconvolutionFor2Dfunction,f(x,y),thepartialderivativeis:

Fordiscretedata,wecanapproximateusingfinitedifferences:

Toimplementaboveasconvolution,whatwouldbetheassociatedfilter?

ee

e

),(),(lim),(0

yxfyxfxyxf -+=

¶¶

®

1),(),1(),( yxfyxf

xyxf -+»

¶¶

13Slidecredit:KristenGrauman

Page 14: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Partialderivativesofanimage

Which shows changes with respect to x?

-1 1

1 -1

or?

-1 1

xyxf

¶¶ ),(

yyxf

¶¶ ),(

(showing filters for correlation) 14Slidecredit:KristenGrauman

Page 15: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Filtersasfeature(edge)detectors

sobel filter

15Slidecredit:KristenGrauman http://homepages.inf.ed.ac.uk/rbf/HIPR2/index.htm

Page 16: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

ImagegradientThegradientofanimage:

Thegradientpointsinthedirectionofmostrapidchangeinintensity

The gradient direction (orientation of edge normal) is given by:

The edge strength is given by the gradient magnitude

16Slidecredit:SteveSeitz

Page 17: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

EffectsofnoiseConsiderasingleroworcolumnoftheimage

• Plottingintensityasafunctionofpositiongivesasignal

Where is the edge?17

Slidecredit:SteveSeitz

Page 18: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Effectsofnoise

•Differencefiltersrespondstronglytonoise• Imagenoiseresultsinpixelsthatlookverydifferentfromtheirneighbors• Generally,thelargerthenoisethestrongertheresponse

•Whatcanwedoaboutit?

Slidecredit:MichaelS.Ryoo

Page 19: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Where is the edge?

Solution:smoothfirst

Look for peaks in 19Slidecredit:KristenGrauman

Page 20: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

Derivativetheoremofconvolution

Differentiationpropertyofconvolution.

20Slidecredit:SteveSeitz

Page 21: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

LaplacianofGaussianConsider

Laplacian of Gaussianoperator

Where is the edge? Zero-crossings of bottom graph 21Slidecredit:SteveSeitz

Page 22: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

2Dedgedetectionfilters

• is the Laplacian operator:

Laplacian of Gaussian

Gaussian derivative of Gaussian

22Slidecredit:SteveSeitz

Two commonly used discrete approximations to the Laplacian filter

Page 23: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,
Page 24: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,
Page 25: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,
Page 26: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

http://onlinelibrary.wiley.com/doi/10.15252/msb.20156651/full#msb156651-fig-0002

CNNforbiologicalimageanalysis

Page 27: Convolutional Neural Networkshomes.soic.indiana.edu/classes/spring2018/info/i529-yye/... · 2017-04-17 · Convolutional Neural Networks Yuzhen Ye School of Informatics and Computing,

MolecularSystemsBiologyVolume12,Issue7,29JUL2016DOI:10.15252/msb.20156651http://onlinelibrary.wiley.com/doi/10.15252/msb.20156651/full#msb156651-fig-0002

CNNforpredictingmoleculartraits

Inputdata:one-dimensionalgenomicsequenceswithonechannelpernucleotide

[Visualrecognition:2D-imagewiththreecolorchannels]