Signal Representations DS-GA 1013 / MATH-GA 2824 Mathematical Tools - - PowerPoint PPT Presentation

signal representations
SMART_READER_LITE
LIVE PREVIEW

Signal Representations DS-GA 1013 / MATH-GA 2824 Mathematical Tools - - PowerPoint PPT Presentation

Signal Representations DS-GA 1013 / MATH-GA 2824 Mathematical Tools for Data Science https://cims.nyu.edu/~cfgranda/pages/MTDS_spring20/index.html Carlos Fernandez-Granda Motivation Limitation of frequency representation: no time resolution


slide-1
SLIDE 1

Signal Representations

DS-GA 1013 / MATH-GA 2824 Mathematical Tools for Data Science

https://cims.nyu.edu/~cfgranda/pages/MTDS_spring20/index.html Carlos Fernandez-Granda

slide-2
SLIDE 2

Motivation

Limitation of frequency representation: no time resolution Limitation of Wiener filtering: cannot adapt to noisy signal

slide-3
SLIDE 3

Windowing Short-time Fourier transform Multiresolution analysis Denoising via thresholding

slide-4
SLIDE 4

Speech signal

0.9 1.0 1.1 1.2 1.3

Time (s)

7500 5000 2500 2500 5000 7500

slide-5
SLIDE 5

Beyond Fourier

Problem: How to capture local fluctuations First segment signal, then compute DFT Naive segmentation: multiplication by rectangular window

slide-6
SLIDE 6

Rectangular window

Rectangular window π ∈ CN with width 2w:

  • π [j] :=
  • 1

if |j| ≤ w,

  • therwise.

Is this a good choice?

slide-7
SLIDE 7

Signal

100 75 50 25 25 50 75 100

Time

1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00

slide-8
SLIDE 8

Window

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0

slide-9
SLIDE 9

Windowed signal

100 75 50 25 25 50 75 100

Time

1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00

slide-10
SLIDE 10

DFT of windowed signal

100 75 50 25 25 50 75 100

Frequency

10 10 20 30 40

slide-11
SLIDE 11

DFT of signal

100 75 50 25 25 50 75 100

Frequency

25 50 75 100 125 150 175 200

slide-12
SLIDE 12

Multiplication in time is convolution in frequency

Let y := x1 ◦ x2 for x1, x2 ∈ CN The DFT of y equals ˆ y = 1 N ˆ x1 ∗ ˆ x2, ˆ x1 and ˆ x2 are the DFTs of x1 and x2 respectively

slide-13
SLIDE 13

Proof

ˆ y [k] :=

N

  • j=1

x1(j)x2(j) exp

  • −i2πkj

N

  • =

N

  • j=1

1 N

n

  • l=1

ˆ x1(l) exp i2πlj N

  • x2(j) exp
  • −i2πkj

N

  • = 1

N

N

  • l=1

ˆ x1(l)

N

  • j=1

x2(j) exp

  • −i2π(k − l)j

N

  • = 1

N

N

  • l=1

ˆ x1(l)ˆ x ↓l

2 [k]

slide-14
SLIDE 14

Rectangular window

  • π [j] :=
  • 1

if |j| ≤ w,

  • therwise,
slide-15
SLIDE 15

DFT of rectangular window

100 75 50 25 25 50 75 100

Frequency

20 20 40 60 80

slide-16
SLIDE 16

DFT of signal

100 75 50 25 25 50 75 100

Frequency

25 50 75 100 125 150 175 200

slide-17
SLIDE 17

DFT of windowed signal

100 75 50 25 25 50 75 100

Frequency

10 10 20 30 40

slide-18
SLIDE 18

Hann window

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0

slide-19
SLIDE 19

Hann window

The Hann window h ∈ CN of width 2w equals h [j] := 1

2

  • 1 + cos
  • πj

w

  • if |j| ≤ w,
  • therwise
slide-20
SLIDE 20

DFT of Hann window

100 75 50 25 25 50 75 100

Frequency

10 20 30 40

slide-21
SLIDE 21

Signal

100 75 50 25 25 50 75 100

Time

1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00

slide-22
SLIDE 22

Hann window

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0

slide-23
SLIDE 23

Windowed signal

100 75 50 25 25 50 75 100

Time

1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00

slide-24
SLIDE 24

DFT of signal

100 75 50 25 25 50 75 100

Frequency

25 50 75 100 125 150 175 200

slide-25
SLIDE 25

DFT of Hann window

100 75 50 25 25 50 75 100

Frequency

10 20 30 40

slide-26
SLIDE 26

DFT of windowed signal

100 75 50 25 25 50 75 100

Frequency

5 10 15 20

slide-27
SLIDE 27

Time-frequency resolution

Time resolution governed by width of window Can we just make the window arbitrarily narrow?

slide-28
SLIDE 28

Compressing in time dilates in frequency and vice versa

x ∈ L2 [−T/2, T/2] is nonzero in a band of width 2w around zero Let y be such that y(t) = x(αt), for all t ∈ [−T/2, T/2] , for some positive real number α such that w/α < T The Fourier series coefficients of y equal ˆ y [k] = 1 α

  • x, φk/α
slide-29
SLIDE 29

Proof

ˆ y [k] = T/2

t=−T/2

y(t) exp

  • −i2πkt

T

  • dt

= w/α

t=−w/α

x(αt) exp

  • −i2πkt

T

  • dt

= 1 α w

τ=−w

x(τ) exp

  • −i2πkτ

αT

= 1 α T/2

τ=−T/2

x(τ) exp

  • −i2πkτ

αT

slide-30
SLIDE 30

w = 90

Time Frequency

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0 100 75 50 25 25 50 75 100

Frequency

20 40 60 80

slide-31
SLIDE 31

w = 30

Time Frequency

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0 100 75 50 25 25 50 75 100

Frequency

5 10 15 20 25 30

slide-32
SLIDE 32

w = 5

Time Frequency

100 75 50 25 25 50 75 100

Time

0.0 0.2 0.4 0.6 0.8 1.0 100 75 50 25 25 50 75 100

Frequency

1 2 3 4 5

slide-33
SLIDE 33

Time-frequency resolution

Fundamental trade-off Uncertainty principle: cannot resolve in time and frequency simultaneously

slide-34
SLIDE 34

Windowing Short-time Fourier transform Multiresolution analysis Denoising via thresholding

slide-35
SLIDE 35

Short-time Fourier transform

  • 1. Segment in overlapping intervals of length ℓ
  • 2. Multiply by window vector
  • 3. Compute DFT of length ℓ
slide-36
SLIDE 36

Short-time Fourier transform

The short-time Fourier transform of x ∈ CN is STFT[ℓ](x)[k, s] :=

  • x, ξ↓ s(1−αov)ℓ

k

  • ,

0 ≤ k ≤ ℓ − 1, 0 ≤ s ≤ N (1 − αov)ℓ, ξk[j] :=

  • w[ℓ](j) exp
  • i2πkj

  • if 1 ≤ j ≤ ℓ
  • therwise

Overlap between adjacent segments equals αovℓ

slide-37
SLIDE 37

k = 3 s = 2 (N := 500, ℓ := 128, αov := 0.5)

Basis vector

100 200 300 400 500 Time 1.0 0.5 0.0 0.5 1.0

STFT coefficient

1 2 3 4 5 6 7 8 9

Time

10 20 30 40 50 60

Frequency

0.0 0.2 0.4 0.6 0.8 1.0

slide-38
SLIDE 38

k = 3 s = 3 (N := 500, ℓ := 128, αov := 0.5)

Basis vector

100 200 300 400 500 Time 1.0 0.5 0.0 0.5 1.0

STFT coefficient

1 2 3 4 5 6 7 8 9

Time

10 20 30 40 50 60

Frequency

0.0 0.2 0.4 0.6 0.8 1.0

slide-39
SLIDE 39

k = 8 s = 2 (N := 500, ℓ := 128, αov := 0.5)

Basis vector

100 200 300 400 500 Time 1.0 0.5 0.0 0.5 1.0

STFT coefficient

1 2 3 4 5 6 7 8 9

Time

10 20 30 40 50 60

Frequency

0.0 0.2 0.4 0.6 0.8 1.0

slide-40
SLIDE 40

k = 23 s = 6 (N := 500, ℓ := 128, αov := 0.5)

Basis vector

100 200 300 400 500 Time 1.0 0.5 0.0 0.5 1.0

STFT coefficient

1 2 3 4 5 6 7 8 9

Time

10 20 30 40 50 60

Frequency

0.0 0.2 0.4 0.6 0.8 1.0

slide-41
SLIDE 41

Matrix representation of STFT

         

F[ℓ]

· · · · · ·

F[ℓ]

· · · · · ·

F[ℓ]

· · · · · · · · · · · · · · · · · · · · · · · · · · ·                     diag

  • w[ℓ]
  • · · ·

· · · diag

  • w[ℓ]
  • · · ·

· · · diag

  • w[ℓ]
  • · · ·

· · · · · · · · · · · · · · · · · ·           x,

slide-42
SLIDE 42

Computing the STFT

Number of segments: nseg := N/(1 − αov)ℓ Complexity of multiplication by window: nsegℓ Complexity of applying DFT: nsegℓ log ℓ (FFT) Total complexity: O(N log ℓ) (overlap is a fixed fraction)

slide-43
SLIDE 43

Inverting the STFT

Apply inverse DFT to each segment Combine segments Same complexity

slide-44
SLIDE 44

Speech signal (window length = 62.5 ms)

1 2 3 4 5 6

Time (s)

10000 5000 5000 10000

slide-45
SLIDE 45

Speech signal (window length = 62.5 ms)

1 2 3 4 5 6

Time (s)

1000 2000 3000 4000

Frequency (Hz)

10

3

10

2

10

1

100 101 102 103

slide-46
SLIDE 46

Windowing Short-time Fourier transform Multiresolution analysis Denoising via thresholding

slide-47
SLIDE 47

Image

slide-48
SLIDE 48

Vertical line (column 135)

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0

slide-49
SLIDE 49

Multiresolution analysis

Scale / resolution at which information is encoded is not uniform Goal: Decompose signals into components at different resolutions

slide-50
SLIDE 50

Multiresolution decomposition

Let N := 2K for some K, a multiresolution decomposition of CN is a sequence of nested subspaces VK ⊂ VK−1 ⊂ . . . ⊂ V0 satisfying: ◮ V0 = CN ◮ Vk is invariant to translations of scale 2k for 0 ≤ k ≤ K. If x ∈ Vk then x ↓ 2k ∈ Vk for all l ∈ Z ◮ For any x ∈ Vj that is nonzero only between 1 and N/2, the dilated vector x↔2 belongs to Vj+1

slide-51
SLIDE 51

Dilation

Let x ∈ CN be such that x[j] = 0 for all j ≥ N/M, where M is a positive integer The dilation of x by a factor of M is x↔M[j] = x j M

slide-52
SLIDE 52

How to build a multiresolution decomposition

◮ Set the coarsest subspace to be spanned by a low-frequency vector ϕ, called a scaling vector or father wavelet VK := span (ϕ) .

slide-53
SLIDE 53

How to build a multiresolution decomposition

◮ Decompose the finer subspaces into the direct sum Vk := Wk ⊕ Vk+1, 0 ≤ k ≤ K − 1, where Wk captures the finest resolution available at level k ◮ Set Wk to be spanned by shifts of a vector µ dilated to have the appropriate resolution: Vk := Wk ⊕ Vk+1, 0 ≤ k ≤ K − 1, WK−1 :=

N−1 2k+1

  • m=0

span

  • µ ↓ m2k+1

↔2k

  • .

The vector µ is called a mother wavelet

slide-54
SLIDE 54

Challenge

How to choose mother and father wavelets? If chosen appropriately, basis vectors can be orthonormal

slide-55
SLIDE 55

Haar wavelet basis

The Haar father wavelet ϕ is a constant vector, such that ϕ[j] := 1 √ N , 1 ≤ j ≤ N The mother wavelet µ satisfies µ[j] :=        − 1

√ 2,

j = 1,

1 √ 2,

j = 2, 0, j > 2 Other options: Meyer, Daubechies, coiflets, symmlets, etc.

slide-56
SLIDE 56

Haar wavelets

Scale Basis functions 20 21 22

slide-57
SLIDE 57

Multiresolution decomposition

VK W2 W1 W0 PVk x is an approximation of x at scale 2k

slide-58
SLIDE 58

Vertical line (column 135)

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0

slide-59
SLIDE 59

Scale 29

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

0.04 0.02 0.00 0.02 0.04 2 4 6 8 10 12 14 16

slide-60
SLIDE 60

Scale 28

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

0.04 0.02 0.00 0.02 0.04 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0

slide-61
SLIDE 61

Scale 27

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8

slide-62
SLIDE 62

Scale 26

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

1 2 3 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4

slide-63
SLIDE 63

Scale 25

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

2 4 6 0.0 0.1 0.2 0.3 0.4 0.5 0.6

slide-64
SLIDE 64

Scale 24

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

5 10 15 0.2 0.0 0.2 0.4 0.6 0.8

slide-65
SLIDE 65

Scale 23

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

10 20 30 0.1 0.0 0.1 0.2 0.3 0.4

slide-66
SLIDE 66

Scale 22

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

20 40 60 0.05 0.00 0.05 0.10 0.15 0.20 0.25

slide-67
SLIDE 67

Scale 21

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

25 50 75 100 125 0.10 0.05 0.00 0.05 0.10 0.15 0.20

slide-68
SLIDE 68

Scale 20

Approximation Coefficients

100 200 300 400 500 0.2 0.4 0.6 0.8 1.0 Data Approximation

50 100 150 200 250 0.2 0.1 0.0 0.1 0.2

slide-69
SLIDE 69

Haar wavelets in the frequency domain

200 150 100 50 50 100 150 200

Frequency

0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16

Width: 200 Width: 100 Width: 50

slide-70
SLIDE 70

Time-frequency support of basis vectors

STFT Wavelets

slide-71
SLIDE 71

2D Wavelets

Extension to 2D by using outer products of 1D basis vectors To build a 2D basis vector at scale (m1, m2) and shift (s1, s2) we set v2D

[s1,s2,m1,m2] := v1D [s1,m1]

  • v1D

[s2,m2]

T , where v1D can refer to 1D father or mother wavelets Nonseparable designs: steerable pyramid, curvelets, bandlets...

slide-72
SLIDE 72

2D Haar wavelet basis vectors

slide-73
SLIDE 73

Image

slide-74
SLIDE 74

2D Haar wavelet decomposition

Approximation Coefficients

300 310 320 330 340 350

slide-75
SLIDE 75

2D Haar wavelet decomposition

Approximation Coefficients

20 40 60 80 100 20 40 60 80 100 20 40 60 80 100

slide-76
SLIDE 76

2D Haar wavelet decomposition

Approximation Coefficients

5 5 10 15 20 25 30 5 5 10 15 20 25 30 5 5 10 15 20 25 30

slide-77
SLIDE 77

2D Haar wavelet decomposition

Approximation Coefficients

5 5 10 15 5 5 10 15 5 5 10 15

slide-78
SLIDE 78

2D Haar wavelet decomposition

Approximation Coefficients

6 4 2 2 4 6 6 4 2 2 4 6 6 4 2 2 4 6

slide-79
SLIDE 79

2D Haar wavelet decomposition

Approximation Coefficients

6 4 2 2 4 6 4 2 2 4 6 4 2 2 4

slide-80
SLIDE 80

2D Haar wavelet decomposition

Approximation Coefficients

2 1 1 2 3 2 1 1 2 3 2 1 1 2 3

slide-81
SLIDE 81

2D Haar wavelet decomposition

Approximation Coefficients

2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5

slide-82
SLIDE 82

2D Haar wavelet decomposition

Approximation Coefficients

1.0 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.5 1.0

slide-83
SLIDE 83

2D Haar wavelet decomposition

Approximation Coefficients

0.6 0.4 0.2 0.0 0.2 0.4 0.6 0.6 0.4 0.2 0.0 0.2 0.4 0.6 0.6 0.4 0.2 0.0 0.2 0.4 0.6

slide-84
SLIDE 84

Windowing Short-time Fourier transform Multiresolution analysis Denoising via thresholding

slide-85
SLIDE 85

Denoising

Aim: Estimate signal x from data of the form y = x + z

slide-86
SLIDE 86

Motivation

STFT coefficients of audio and wavelet coefficients of images are sparse Coefficients of noise are dense Idea: Get rid of small entries in Ay = Ax + A z

slide-87
SLIDE 87

Why are noise coefficients dense?

If ˜ z is Gaussian with mean µ and covariance matrix Σ, then for any A, A˜ z is Gaussian with mean Aµ and covariance matrix AΣA∗ If A is orthogonal, iid zero mean noise is mapped to iid zero mean noise

slide-88
SLIDE 88

Example

Data Signal

slide-89
SLIDE 89

Thresholding

Hard-thresholding operator Hη (v) [j] :=

  • v [j]

if |v [j]| > η

  • therwise
slide-90
SLIDE 90

Denoising via hard thresholding

Estimate Signal

slide-91
SLIDE 91

Denoising via hard thresholding

Given data y and a sparsifying linear transform A

  • 1. Compute coefficients Ay
  • 2. Apply the hard-thresholding operator Hη : Cn → Cn to Ay
  • 3. Invert the transform

xest := L Hη (Ay) , where L is a left inverse of A

slide-92
SLIDE 92

Speech signal

4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 Time (s) 7500 5000 2500 2500 5000 7500

slide-93
SLIDE 93

STFT coefficients 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

5

10

4

10

3

10

2

10

1

slide-94
SLIDE 94

Noisy signal

4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 Time (s) 7500 5000 2500 2500 5000 7500 10000

slide-95
SLIDE 95

STFT coefficients 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

4

10

3

10

2

10

1

slide-96
SLIDE 96

Thresholded STFT coefficients 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

5

10

4

10

3

10

2

10

1

slide-97
SLIDE 97

Denoised signal

4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 Time (s) 7500 5000 2500 2500 5000 7500

slide-98
SLIDE 98

Denoised signal

4.3600 4.3625 4.3650 4.3675 4.3700 4.3725 4.3750 4.3775 Time (s) 3000 2000 1000 1000 2000 3000 Signal STFT thresholding Noisy data

slide-99
SLIDE 99

Denoised signal (Wiener filtering)

4.3600 4.3625 4.3650 4.3675 4.3700 4.3725 4.3750 4.3775 Time (s) 3000 2000 1000 1000 2000 3000 Signal Wiener denoising Noisy data

slide-100
SLIDE 100

Image

slide-101
SLIDE 101

Wavelet coefficients

slide-102
SLIDE 102

Noisy signal

slide-103
SLIDE 103

Wavelet coefficients

slide-104
SLIDE 104

Thresholded wavelet coefficients

slide-105
SLIDE 105

Denoised signal

slide-106
SLIDE 106

Comparison

Clean Noisy Wiener filtering Wavelet thresholding

slide-107
SLIDE 107

Coefficients are structured 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

5

10

4

10

3

10

2

10

1

slide-108
SLIDE 108

Coefficients are structured

slide-109
SLIDE 109

Block thresholding

Assumption: Coefficients are group sparse, nonzero coefficients cluster together Threshold according to block of surrounding coefficients Ij Bη (v) [j] :=

  • v [j]

if j ∈ Ij such that

  • vIj
  • 2 > η, ,
  • therwise,
slide-110
SLIDE 110

Denoising via block thresholding

Given data y and a sparsifying linear transform A

  • 1. Compute coefficients Ay
  • 2. Apply the block-thresholding operator Hη : Cn → Cn to Ay
  • 3. Inverting the transform

xest := L Bη (Ay) , where L is a left inverse of A

slide-111
SLIDE 111

Noisy STFT coefficients 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

4

10

3

10

2

10

1

slide-112
SLIDE 112

Thresholded STFT coefficients 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

5

10

4

10

3

10

2

10

1

slide-113
SLIDE 113

Block-thresholded STFT coefficients (block of length 5) 2 4 6 Time (s) 1000 2000 3000 4000 Frequency (Hz) 10

5

10

4

10

3

10

2

10

1

slide-114
SLIDE 114

Thresholding

4.3600 4.3625 4.3650 4.3675 4.3700 4.3725 4.3750 4.3775 Time (s) 3000 2000 1000 1000 2000 3000 Signal STFT thresholding Noisy data

slide-115
SLIDE 115

Block thresholding

4.3600 4.3625 4.3650 4.3675 4.3700 4.3725 4.3750 4.3775 Time (s) 3000 2000 1000 1000 2000 3000 Signal STFT block thresholding Noisy data

slide-116
SLIDE 116

Noisy wavelet coefficients

slide-117
SLIDE 117

Thresholded wavelet coefficients

slide-118
SLIDE 118

Block thresholded wavelet coefficients

slide-119
SLIDE 119

Denoised signal

slide-120
SLIDE 120

Comparison

Clean Noisy Wiener filtering Wavelet thresholding Wavelet block thresholding