Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1....

28
Fully Convolutional Networks for Semantic Segmentation Marek Leibl Center for Machine Perception, Department of Cybernetics, FEL CTU March 30, 2017 Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU) Biomedical Images Recognition March 30, 2017 1 / 28

Transcript of Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1....

Page 1: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Fully Convolutional Networks for SemanticSegmentation

Marek Leibl

Center for Machine Perception, Department of Cybernetics, FEL CTU

March 30, 2017

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 1 / 28

Page 2: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Presentation Outline

Introduction ... convolutional neural networks

Semantic Segmentation ... fully convolutional neural networks

Conditional Random Fields ... and recurrent neural networks

Applications ... drosophila eggs segmentation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 2 / 28

Page 3: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Convolutional Neural Networks

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 3 / 28

Page 4: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Convolutional Neural Networks - Introduction

Convolutional Neural Networks (CNNs)

layered artificial neural networkinspired by organization of the animal visual cortexlocal connectivity

Deep Convolutional Neural Networks

many convolutional layers often combined with max-pooling andrelu

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 4 / 28

Page 5: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CNNs - Convolution

Convolution = building block of CNNs

G[i, j] =∑u

∑v

H[u, v] · F [i− u, j − v]

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 5 / 28

Page 6: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CNNs - Example

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 6 / 28

Page 7: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CNNs - Structure

Neurons in each layer organized into 3D matrixes

2 spatial dimensions1 dimension for channels (features)

Local connectivity

each neuron relatively small number of input connections ...receptive field

Shared weights

weights are invariant to translations in spatial dimensionsreduced search space and better robustness

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 7 / 28

Page 8: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CNNs - Building blocks

Convolutional layer

trainable weightstypically followed by Relu

Relu (rectified linear unit)

f(x) = max(0, x)introduces non-linearity to CNNeasy to compute, no saturation

Max-pooling

reducing spatial size

Softmax

normalized exponentialfunctionf(x)j = exj∑

i exi

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 8 / 28

Page 9: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CNNs - Deep CNN architectures for image classification

GoogLeNet (2015)

9 Inception modulesover 100 layerstrained on a few GPUswithin a week

Microsoft ResNet (2015)

152 layersresidual blocks→ easier to optimizetrained on an 8 GPU machinefor two to three weeks

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 9 / 28

Page 10: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Semantic Segmentation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 10 / 28

Page 11: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Semantic Segmentation vs Image Classification

Image classification: determine class for a given image

super human performance on some tasks

Semantic segmentation: determine class for each pixel

harder problem

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 11 / 28

Page 12: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Fully Convolutional Neural Netwoks

Fully Convolutional Neural Netwok

no fully connected layeroutput: pixel-wise prediction

Training Fully Convolutional NNs

needed label for each pixel (ground truth)need to be manually segmented by human→ training set is usually expensive

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 12 / 28

Page 13: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Fully Convolutional Neural Netwoks: Architectures

SegNet (2015)

deep encoder-decoder architectureUniversity of Cambridge

U-Net (2015)

U-shaped architecturebiomedical image segmentation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 13 / 28

Page 14: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Fully Convolutional Neural Netwoks: SegNet

SegNet (2015)

deep encoder-decoder architectureUniversity of Cambridgehttp://mi.eng.cam.ac.uk/projects/segnet/

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 14 / 28

Page 15: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Fully Convolutional Neural Netwoks: U-Net

U-Net (2015)

U-shaped architecturebiomedical image segmentation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 15 / 28

Page 16: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Conditional Random Fields&

Convolutional Neural Networks

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 16 / 28

Page 17: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Drawbacks of fully connected CNNs

CNNs ouperforms “classical” methods onmajority of semantic segmenations tasks

they still fail in some cases

Cross entropy loss

does not considerglobal consistencycan only use informationwithin its receptive field

→ “holes” in the segmentation map→ inconsistent segmentation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 17 / 28

E = −∑x

∑c

pxclog(yxc)

Page 18: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Conditional Random Fields: Introduction

Conditional Random Field (CRF)

probabilistic graphical modeltwo types of variables:

observations (e.g. original image)random variables (e.g. pixel-wise segmentation)

used for structured predictione.g. semantic segmentationthese days outperformed by CNNs

CRF as a post-processing methodto improve CNN output

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 18 / 28

Page 19: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Conditional Random Fields: Formal Definition

Markov Random Field (MRF)

G = (V,E) undirected graphY = {Yv}v∈V

Yv|YN(v) ⊥⊥ YV \N [v]|YN(v)

Conditional Random Field (CRF)G = (V,E) undirected graph

V = {1, ..., N} ... pixelsE ... define neighbors

I = {Ii}N1 ... observation for each pixelX = {Xi}N1 ... random variable for each pixelX|I is a Markov Random Field (MRF)→ P (X = x|I) = 1

Z(I)exp {−E(x|I)}

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 19 / 28

Page 20: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Conditional Random Fields Postprocessing

Goal: maximize P (X = x|I) = 1Z(I)exp {−EI(x)}

I ... CNN segmentationX ... final segmentation

→ minimize energy function:

EI(x) =∑

i ψu(xi) +∑

i<j ψp(xi, xj)NP-hard for general graphs

→ Mean Field Approximation

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 20 / 28

Page 21: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CRF: Mean Field Iteration as RNN

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 21 / 28

Page 22: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

CRF as RNN

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 22 / 28

Page 23: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Drosophila Eggs Segmentaion

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 23 / 28

Page 24: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Problem Definition

Binary segmentation of microscopy scans

classes: the eggs and the background

75 manually annotated images of drosophila eggs

4000 unlabeled images

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 24 / 28

Page 25: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

U-Net architecture

U-shaped Convolutional Neural Networkthe usual convolution-pooling path followed by the upsampling pathoutput: segmentation map of the input image

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 25 / 28

Page 26: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Results

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 26 / 28

Page 27: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Thank You!

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 27 / 28

Page 28: Fully Convolutional Networks for Semantic Segmentationai.ms.mff.cuni.cz/~sui/leibl.pdf · 2018. 1. 17. · Presentation Outline Introduction... convolutional neural networks Semantic

Links

http://cs231n.stanford.edu/

https://adeshpande3.github.io/adeshpande3.github.io/The-9-Deep-Learning-Papers-You-Need-To-Know-About.html

http://www.robots.ox.ac.uk/ szheng/CRFasRNN.html

https://www.tensorflow.org

Marek Leibl (Center for Machine Perception, Department of Cybernetics, FEL CTU)Biomedical Images Recognition March 30, 2017 28 / 28