Image Processing 2. Hakan Bilen University of Edinburgh. Computer Graphics Fall 2017

Similar documents
Filtering, Frequency, and Edges

Slow mo guys Saccades.

Recap of Monday. Linear filtering. Be aware of details for filter size, extrapolation, cropping

The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall Many slides borrowed from Steve Seitz

CSCI 1290: Comp Photo

The Frequency Domain, without tears. Many slides borrowed from Steve Seitz

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

ECE Digital Image Processing and Introduction to Computer Vision. Outline

Thinking in Frequency

The Frequency Domain. Many slides borrowed from Steve Seitz

CS 4495 Computer Vision. Frequency and Fourier Transforms. Aaron Bobick School of Interactive Computing. Frequency and Fourier Transform

Intelligent Visual Prosthesis

G52IVG, School of Computer Science, University of Nottingham

Introduction to the Fourier transform. Computer Vision & Digital Image Processing. The Fourier transform (continued) The Fourier transform (continued)

Image Filtering, Edges and Image Representation

Fourier Transform and Frequency Domain

Introduction to Fourier Analysis Part 2. CS 510 Lecture #7 January 31, 2018

Fourier Transform and Frequency Domain

Frequency2: Sampling and Aliasing

Why does a lower resolution image still make sense to us? What do we lose? Image:

Overview of Fourier Series (Sect. 6.2). Origins of the Fourier Series.

Key Intuition: invertibility

Lecture 4 Filtering in the Frequency Domain. Lin ZHANG, PhD School of Software Engineering Tongji University Spring 2016

Fourier Matching. CS 510 Lecture #7 February 8 th, 2013

Reference Text: The evolution of Applied harmonics analysis by Elena Prestini

Analysis II: Fourier Series

Examples of the Fourier Theorem (Sect. 10.3). The Fourier Theorem: Continuous case.

CS 6501: Deep Learning for Computer Graphics. Basics of Neural Networks. Connelly Barnes

Weighted SS(E) = w 2 1( y 1 y1) y n. w n. Wy W y 2 = Wy WAx 2. WAx = Wy. (WA) T WAx = (WA) T b

ECG782: Multidimensional Digital Signal Processing

Name: Student number:

MIT 2.71/2.710 Optics 10/31/05 wk9-a-1. The spatial frequency domain

Making Deep Learning Understandable for Analyzing Sequential Data about Gene Regulation

Grundlagen der Künstlichen Intelligenz

Image pyramids and frequency domain

I Chen Lin, Assistant Professor Dept. of CS, National Chiao Tung University. Computer Vision: 4. Filtering

Image Processing /6.865 Frédo Durand A bunch of slides by Bill Freeman (MIT) & Alyosha Efros (CMU)

Maxout Networks. Hien Quoc Dang

Introduction to Convolutional Neural Networks (CNNs)

GBS765 Electron microscopy

Neural Networks in Structured Prediction. November 17, 2015

Today s lecture. Local neighbourhood processing. The convolution. Removing uncorrelated noise from an image The Fourier transform

IMAGE ENHANCEMENT: FILTERING IN THE FREQUENCY DOMAIN. Francesca Pizzorni Ferrarese

Contents. Signals as functions (1D, 2D)

Lecture 14: Deep Generative Learning

Contents. Signals as functions (1D, 2D)

(Feed-Forward) Neural Networks Dr. Hajira Jabeen, Prof. Jens Lehmann

Contents. Signals as functions (1D, 2D)

Digital Image Processing. Image Enhancement: Filtering in the Frequency Domain

Fourier and Partial Differential Equations

FILTERING IN THE FREQUENCY DOMAIN

Do you like to be successful? Able to see the big picture

An improper integral and an infinite series

Fourier Transform in Image Processing. CS/BIOEN 6640 U of Utah Guido Gerig (slides modified from Marcel Prastawa 2012)

Frequency Filtering CSC 767

CSE446: Neural Networks Spring Many slides are adapted from Carlos Guestrin and Luke Zettlemoyer

Tasks ADAS. Self Driving. Non-machine Learning. Traditional MLP. Machine-Learning based method. Supervised CNN. Methods. Deep-Learning based

Digital Image Processing

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Introduction to Fourier Analysis. CS 510 Lecture #5 February 2 nd 2015

What s so Hard about Natural Language Understanding?

Dr. David A. Clifton Group Leader Computational Health Informatics (CHI) Lab Lecturer in Engineering Science, Balliol College

Machine Learning Linear Models

Generative Adversarial Networks. Presented by Yi Zhang

Chapter 20. Deep Generative Models

Neural Networks for Machine Learning. Lecture 2a An overview of the main types of neural network architecture

Math 251 December 14, 2005 Final Exam. 1 18pt 2 16pt 3 12pt 4 14pt 5 12pt 6 14pt 7 14pt 8 16pt 9 20pt 10 14pt Total 150pt

Warm up: risk prediction with logistic regression

MATH 251 Final Examination December 19, 2012 FORM A. Name: Student Number: Section:

Autumn 2015 Practice Final. Time Limit: 1 hour, 50 minutes

Overview. Signals as functions (1D, 2D) 1D Fourier Transform. 2D Fourier Transforms. Discrete Fourier Transform (DFT) Discrete Cosine Transform (DCT)

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Advanced Machine Learning

THE UNIVERSITY OF WESTERN ONTARIO. Applied Mathematics 375a Instructor: Matt Davison. Final Examination December 14, :00 12:00 a.m.

2 Problem Set 2 Graphical Analysis

Machine Learning: Basis and Wavelet 김화평 (CSE ) Medical Image computing lab 서진근교수연구실 Haar DWT in 2 levels

Fourier Series and Recent Developments in Analysis

Physics 250 Green s functions for ordinary differential equations

Calculus III: Practice Final

PHYS 502 Lecture 3: Fourier Series

Lecture 5. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Frequency Response and Continuous-time Fourier Series

TTIC 31230, Fundamentals of Deep Learning, Winter David McAllester. The Fundamental Equations of Deep Learning

Additional Pointers. Introduction to Computer Vision. Convolution. Area operations: Linear filtering

Convolutional Neural Networks. Srikumar Ramalingam

Today. Calculus. Linear Regression. Lagrange Multipliers

CHAPTER 3 POTENTIALS 10/13/2016. Outlines. 1. Laplace s equation. 2. The Method of Images. 3. Separation of Variables. 4. Multipole Expansion

Understanding How ConvNets See

Generative Adversarial Networks

14 Fourier analysis. Read: Boas Ch. 7.

Neural networks. Chapter 19, Sections 1 5 1

Machine Learning. Boris

Convolutional Neural Network. Hung-yi Lee

RED. Math 113 (Calculus II) Final Exam Form A Fall Name: Student ID: Section: Instructor: Instructions:

ECE 595: Machine Learning I Adversarial Attack 1

Topics we covered. Machine Learning. Statistics. Optimization. Systems! Basics of probability Tail bounds Density Estimation Exponential Families

Understanding CNNs using visualisation and transformation analysis

Summer Assignment Directions:

Math 241 Final Exam, Spring 2013

Neural networks and optimization

Transcription:

Image Processing 2 Hakan Bilen University of Edinburgh Computer Graphics Fall 2017

This week What is an image? What is image processing? Point processing Linear (Spatial) filters Frequency domain Deep image processing

Salvador Dali Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln, 1976 Slide credits: A. Efros

Why?

A set of basis functions Teases away fast vs. slow changes in the image. This change of basis has a special name Slide Credit: A. Efros

Jean Baptiste Joseph Fourier (1768-1830) Fourier had a crazy idea (1807): Any univariate function can be rewritten as a weighted sum of sines and cosines of different frequencies....the manner in which the author arrives at these equations is not exempt of difficulties and...his analysis to integrate them still leaves something to be desired on the score of generality and even rigour. don t believe it? Neither did Lagrange, Laplace, Poisson and other big wigs Not translated into English until 1878! Laplace but it s (mostly) true! called Fourier Series Lagrange Legendre http://www-history.mcs.st-andrews.ac.uk/biographies/fourier.html Slide Credit: A. Efros

1D Fourier Series Example: A step edge f x = ቊ 1 if x < 0 1 otherwise x Fourier Decomposition f x = n=1 π a n sin nx a n = 1 π න f x sin nx dx π = 2 π 4 π න f x sin nx dx = ቐ if n is odd nπ 0 0 otherwise 4 f x = sin 2n 1 x 2n 1 π n=1 Slide Credit: A. Zisserman

1D Fourier Series Example: A square wave = + f x = sinx + 1 3 sin 3x Slide Credit: A. Zisserman

1D Fourier Series Example: A square wave f x = sinx + 1 3 sin 3x + 1 5 sin 5x Slide Credit: A. Zisserman

1D Fourier Series Example: A square wave f x = sinx + 1 3 sin 3x + 1 5 sin 5x + Slide Credit: A. Zisserman

1D Fourier Series Example: A square wave f x = 4 π (sinx + 1 3 sin 3x + 1 5 sin 5x + ) Slide Credit: A. Zisserman

Fourier series: just a change of basis Mf x = F ω = Slide Credit: A. Zisserman

Fourier series: just a change of basis M 1 F ω = f x = Slide Credit: A. Zisserman

Transform pair for 1D = u F f x e j2πux dx, = x f F u e j2πux du 1D/2D Fourier Transform e j2πux = cos 2πux + jsin(2πux) Transform pair for 2D = v F u, f x, y e j2π(ux+vy) dxdy, = y f x, F u, v e j2π(ux+vy) dudv F u, v is complex in general, F u, v = F R u, v + jf C u, v F u, v is the magnitude spectrum arctan( F C u,v F R u,v ) is the phase spectrum Slide Credit: A. Zisserman

Sinusoidal Waves Fourier Transform is based on a decomposition into orthogonal basis functions: e j2πux = cos 2πux + jsin 2πux Orthogonality: http://ms.mcmaster.ca/courses/20102011/term4/math2zz3/lecture1.pdf The maxima and minima occur when 2π ux + vy = nπ write ux + vy in vector notation with u = u, v T and x = x, y T then 2π ux + vy = 2πu x = nπ are sets of equally spaced parallel lines with normal u and 1 wavelength u 2 +v 2 Slide Credit: A. Zisserman

The real component of Fourier basis elements shown as intensity images Plot a basis element --- or rather, its real part --- as a function of x,y for some fixed (u,v). We get a function that is constant when (ux+vy) is constant. The magnitude of the vector (u, v) gives a frequency, and its direction gives an orientation. The function is a sinusoid with this frequency along the direction, and constant perpendicular to the direction. Slide Credit: B. Freeman

Here the magnitude of the vector (u, v) is larger than the previous one and angle is different Slide Credit: B. Freeman

Image Credit: Forsyth & Ponce

original low pass high pass f(x, y) F(u, v)

Convolution Theorem f x, y h x, y F u, v H u, v Space convolution = frequency multiplication In words: the Fourier transform of the convolution of two functions is the product of their individual Fourier transforms Why is it so important? Because linear filtering operations can be carried out by simple multiplications in the Fourier domain Slide Credit: A. Zisserman

Convolution Theorem The link between operations in the action of linear filters and frequency domain Example f(x, y) g(x, y) Fourier transform inverse Fourier transform F(u, v) G(u, v)

Fourier Transform: Applications Image Blending (Oliva etal 2006)

Forensic application Fourier Transform: Applications F(u, v) Image enhancement: Lunar orbital image Remove peaks Periodic bg removed F(u, v) Remove peaks Lines removed Slide Credit: A. Zisserman

More advanced applications Deep image processing So far, we assumed that we have the ideal filters to enhance images (to blur, sharpen, resize) ideal models and priors (to super-resolve, remove noise) What if we had a learning machine that can learn to map an input to output? Black Box Learning Machine Image Credit: Pathak et al.

Perceptron [Rosenblatt 1957] n f x = i=1 1 if f x > 0 w i x n + b, y = ቊ 0 otherwise Inputs Output (Class) Weights: arbitrary, learned parameters Bias b: arbitrary, learned parameter Image Credit: C. Barnes

MultiLayer Perceptron (MLP) Universal Approximation Theorem: a single hidden layer and linear output layer can approximate any continuous function. H 0 = h 01, h 02,, h 0n H 1 = h 1 = σ w 1 h 0 O = σ(w 2 σ(w 1 H 0 )) = x 1, x 2,, x n Activation functions (σ) h 11 x 1 h 12 h 21 o 1 x 2 h 13 h 22 o 2 x n h 1k Image Credit: Wikipedia

Convolutional Neural Networks [Lecun et al 1998] Activation function Layer (l) convolution filters H l+1 = σ(h l W l1, W l2,, W lk + [b l1, b l2,, b lk ]) Layer (l+1) feature map Layer (l) feature map Biases http://www.deeplearningbook.org/

Deep learning guide When to use it? Do you have plenty of input data (images, videos, text, audio)? Do you have supervisory signal for each input point (image and its label cat )? Do you have enough computation resources (this means expensive graphics cards)? Or are you working for Google, Facebook? Can you specify a good compatibility function (loss) between output and desired output?

Back to applications Image Inpainting (Pathak et al. 2016) Goal: Generate the contents of an arbitrary image region conditioned on its surroundings CNN Supervision is free and infinite!

More applications Image colorization (Zhang et al 2016) Goal: Generate realistic colours for a given a grayscale image CNN Grayscale Output Ground-truth

Selection of loss function Applications Image colorization (Zhang et al 2016)

Applications Image colorization (Zhang et al 2016) Ground Truth L2 Regression Class w/ Rebalancing

Applications Style Transfer (Gatys et al 2015) Goal: Create artistic images of high perceptual quality Method: Match style and content of source and target images Style representation: correlations between the different filter responses over the spatial extent of feature maps Content representation: different filter responses over the spatial extent of feature maps Loss = αloss content + βloss style

Applications Style Transfer (Gatys et al 2015) Goal: Create artistic images of high perceptual quality

Applications Style Transfer (Gatys et al 2015)

Applications Generative Adversarial Networks (GANs) (Goodfellow et al 2014) We can colorize, inpaint and stylize images by using neural networks. How about generating new images? CNN Loss? Can we use L2 loss? What kind of loss can we use?

Applications Generative Adversarial Networks (Goodfellow et al 2014) Density estimation: We want outputs of our model (parametrized by θ) to be similar to distribution of input data We have a pair of networks, Generator (G) and Discriminator (D) They fight against each other G goal: make its probability distribution similar to training set and make prediction that G cannot distinguish D goal: distinguish between G s prediction and real data Fake? 10 Pounds 10 Pounds

Applications PPGAN (Nguyen et al 2016)

Applications GAN Bad examples: Neural Photo Editing with Introspective Adversarial Networks https://www.youtube.com/watch?v=fdelbfseqqs

Notes B1: Chapter 9.4 Fourier Transform Additional reading: http://www.deeplearningbook.org/ Part II, Chapter 6