optimization and image processing · optimization and image processing erin e. tripp overview image...

46
Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization and Image Processing Erin E. Tripp Syracuse University November 2018

Upload: others

Post on 17-Apr-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization and Image Processing

Erin E. Tripp

Syracuse University

November 2018

Page 2: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Table of Contents

1 Overview

2 Image Denoising

3 Foreground Detection

Page 3: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Image Denoising

We receive a blurry, noisy image:

and we want to recover the original.

Page 4: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Image Denoising

For example, even a visually imperceptible amount of noise cancause a neural net to misclassify the image with highprobability. 1

1From Explaining and Harnessing Adversarial Examples by Goodfellow, Shlens, and Szegedy.

Page 5: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Foreground Detection

We want to separate moving objects from the nonmovingbackground in video data:

Page 6: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 7: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 8: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)

a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 9: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 10: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 11: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Optimization

How are these optimization problems?

First, we develop a mathematical model for our problem.

This consists of:

a function C (x) that measures the quantity of interest(variations in pixel values, similarity to input, etc)a constraint set S which restricts the acceptable answers(matrices satisfying certain inequalities, etc.)

So the problem becomes

arg minx∈S

C (x)

We can then use a variety of algorithms for findingminimizers of functions.

Page 12: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing image data

How do we turn an image into a mathematical object?

The image becomes a matrix, and the entries of the matrixare the pixel values, ranging from 0 (black) to 255 (white).For example, 0 10 83

25 103 15011 60 98

represents a 3× 3 pixel grayscale image.

The cameraman example is 256× 256 (65536) pixels.

Page 13: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing image data

How do we turn an image into a mathematical object?

The image becomes a matrix, and the entries of the matrixare the pixel values, ranging from 0 (black) to 255 (white).For example, 0 10 83

25 103 15011 60 98

represents a 3× 3 pixel grayscale image.

The cameraman example is 256× 256 (65536) pixels.

Page 14: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing image data

How do we turn an image into a mathematical object?

The image becomes a matrix, and the entries of the matrixare the pixel values, ranging from 0 (black) to 255 (white).For example, 0 10 83

25 103 15011 60 98

represents a 3× 3 pixel grayscale image.

The cameraman example is 256× 256 (65536) pixels.

Page 15: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

For video footage, we want to deal with several frames(individual images) at once.

Each frame is entered as a matrix then transformed into acolumn:

0 10 8325 103 15011 60 98

−→

0251110

1036083

15088

Page 16: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

For video footage, we want to deal with several frames(individual images) at once.

Each frame is entered as a matrix then transformed into acolumn:

0 10 8325 103 15011 60 98

−→

0251110

1036083

15088

Page 17: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

0 10 8325 103 15011 60 98

20 100 01 0 270 12 201

17 0 55234 60 0

0 106 111

frame 1 frame 2 frame 3

Multiple frames are then concatenated:

0 20 1725 1 23411 0 010 100 0

103 0 6060 12 10683 0 55

150 27 098 201 111

Page 18: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

In our video example, each frame is 120× 160 (19200)pixels. This becomes a 19200× 1 column.

If we use 200 frames, our video matrix will be a19200× 200 matrix!

Note: More frames = more accurate foregroundseparation, but also more computations.

Page 19: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

In our video example, each frame is 120× 160 (19200)pixels. This becomes a 19200× 1 column.

If we use 200 frames, our video matrix will be a19200× 200 matrix!

Note: More frames = more accurate foregroundseparation, but also more computations.

Page 20: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Processing video data

In our video example, each frame is 120× 160 (19200)pixels. This becomes a 19200× 1 column.

If we use 200 frames, our video matrix will be a19200× 200 matrix!

Note: More frames = more accurate foregroundseparation, but also more computations.

Page 21: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Table of Contents

1 Overview

2 Image Denoising

3 Foreground Detection

Page 22: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How do we represent image denoising as an optimizationproblem?

arg min f (Y ) +1

2λ‖X − Z‖2F

subject to Y = DX

Z is the noisy input imageD computes the difference between adjacent pixelsf penalizes small differences in the data

Page 23: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How do we represent image denoising as an optimizationproblem?

arg min f (Y ) +1

2λ‖X − Z‖2F

subject to Y = DX

Z is the noisy input imageD computes the difference between adjacent pixelsf penalizes small differences in the data

Page 24: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How do we represent image denoising as an optimizationproblem?

arg min f (Y ) +1

2λ‖X − Z‖2F

subject to Y = DX

Z is the noisy input image

D computes the difference between adjacent pixelsf penalizes small differences in the data

Page 25: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How do we represent image denoising as an optimizationproblem?

arg min f (Y ) +1

2λ‖X − Z‖2F

subject to Y = DX

Z is the noisy input imageD computes the difference between adjacent pixels

f penalizes small differences in the data

Page 26: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How do we represent image denoising as an optimizationproblem?

arg min f (Y ) +1

2λ‖X − Z‖2F

subject to Y = DX

Z is the noisy input imageD computes the difference between adjacent pixelsf penalizes small differences in the data

Page 27: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Algorithm

We use the Alternating Direction Method of Multipliers.

Page 28: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Algorithm

We use the Alternating Direction Method of Multipliers.

First write the augmented Lagrangian Lη(X ,Y ,P) for thisproblem:

f (Y ) +1

2λ‖X − Z‖2F − 〈P,DX − Y 〉+

η

2‖DX − Y ‖2F

Page 29: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Algorithm

We use the Alternating Direction Method of Multipliers.

First write the augmented Lagrangian Lη(X ,Y ,P) for thisproblem:

f (Y ) +1

2λ‖X − Z‖2F − 〈P,DX − Y 〉+

η

2‖DX − Y ‖2F

ADMM:

Input X0,Y0

For k = 1, . . . ,N

Yk+1 = arg minY

Lη(Xk ,Y ,Pk)

Xk+1 = arg minX

Lη(X ,Yk+1,Pk)

Pk+1 = Pk − η(DXk+1 − Yk+1)

Page 30: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Algorithm

We use the Alternating Direction Method of Multipliers.

First write the augmented Lagrangian Lη(X ,Y ,P) for thisproblem:

f (Y ) +1

2λ‖X − Z‖2F − 〈P,DX − Y 〉+

η

2‖DX − Y ‖2F

ADMM:

Input X0,Y0

For k = 1, . . . ,N

Yk+1 = arg minY

Lη(Xk ,Y ,Pk)

Xk+1 = arg minX

Lη(X ,Yk+1,Pk)

Pk+1 = Pk − η(DXk+1 − Yk+1)

Page 31: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Results

Page 32: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Table of Contents

1 Overview

2 Image Denoising

3 Foreground Detection

Page 33: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How can we model foreground detection as an optimizationproblem?

Page 34: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How can we model foreground detection as an optimizationproblem?Let Y be the video matrix. We assume Y can be decomposedas Y = M + S , where

M is a low rank matrix (the stable background)

S is a sparse matrix (the moving foreground)

Page 35: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How can we model foreground detection as an optimizationproblem?Let Y be the video matrix. We assume Y can be decomposedas Y = M + S , where

M is a low rank matrix (the stable background)

S is a sparse matrix (the moving foreground)

Page 36: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

How can we model foreground detection as an optimizationproblem?Let Y be the video matrix. We assume Y can be decomposedas Y = M + S , where

M is a low rank matrix (the stable background)

S is a sparse matrix (the moving foreground)

Page 37: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

Since we don’t know M and S we want to find approximationsM̃ and S̃ .

Page 38: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

Since we don’t know M and S we want to find approximationsM̃ and S̃ .

Then the problem can be rephrased as, “How close is ourapproximation to the actual solution?”

Page 39: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Modeling the Problem

Since we don’t know M and S we want to find approximationsM̃ and S̃ .

Then the problem can be rephrased as, “How close is ourapproximation to the actual solution?”

Mathematically, we want to minimize

‖M̃ + S̃ − Y ‖2F

Page 40: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Sketch of Algorithm

Projected gradient descent:

Create an initial estimate S0 of S and set M0 = Y − S0.

Factor M0 = U0V>0

Perform gradient descent on the function

‖UV> + S − Y ‖2F

with respect to U and V respectively, projecting each stepback onto the constraint sets. Update S accordingly.

Page 41: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Sketch of Algorithm

Projected gradient descent:

Create an initial estimate S0 of S and set M0 = Y − S0.

Factor M0 = U0V>0

Perform gradient descent on the function

‖UV> + S − Y ‖2F

with respect to U and V respectively, projecting each stepback onto the constraint sets. Update S accordingly.

Page 42: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Sketch of Algorithm

Projected gradient descent:

Create an initial estimate S0 of S and set M0 = Y − S0.

Factor M0 = U0V>0

Perform gradient descent on the function

‖UV> + S − Y ‖2F

with respect to U and V respectively, projecting each stepback onto the constraint sets. Update S accordingly.

Page 43: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Sketch of Algorithm

Projected gradient descent:

Create an initial estimate S0 of S and set M0 = Y − S0.

Factor M0 = U0V>0

Perform gradient descent on the function

‖UV> + S − Y ‖2F

with respect to U and V respectively, projecting each stepback onto the constraint sets. Update S accordingly.

Page 44: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

Results

The original frame; the foreground; and the background.

Page 45: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection

References

S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein,Distributed Optimization and Statistical Learning via theAlternating Direction Method of Multipliers, Foundations andTrends in Machine Learning, Vol. 3, No. 1 (2010) 1–122.

X. Yi, D. Park, Y. Chen, and C. Caramanis, Fast Algorithms forRobust PCA via Gradient Descent, Preprint, arXiv:1605.07784v1 [cs.IT] (2016).

Page 46: Optimization and Image Processing · Optimization and Image Processing Erin E. Tripp Overview Image Denoising Foreground Detection Optimization How are these optimization problems?

Optimizationand ImageProcessing

Erin E. Tripp

Overview

ImageDenoising

ForegroundDetection Thank you!