Boxlets: a Fast Convolution Algorithm for. Signal Processing and Neural Networks. Patrice Y. Simard, Leon Bottou, Patrick Haner and Yann LeCun

Similar documents
Examples. 2-input, 1-output discrete-time systems: 1-input, 1-output discrete-time systems:

Dynamic Green Function Solution of Beams Under a Moving Load with Dierent Boundary Conditions

Sum of Coherent Systems Decomposition by SVD. University of California at Berkeley. Berkeley, CA September 21, 1995.

The DFT as Convolution or Filtering

A general theory of discrete ltering. for LES in complex geometry. By Oleg V. Vasilyev AND Thomas S. Lund

Gaussian Process Regression: Active Data Selection and Test Point. Rejection. Sambu Seo Marko Wallat Thore Graepel Klaus Obermayer

Joint Optimum Bitwise Decomposition of any. Memoryless Source to be Sent over a BSC. Ecole Nationale Superieure des Telecommunications URA CNRS 820

Linear Algebra (part 1) : Vector Spaces (by Evan Dummit, 2017, v. 1.07) 1.1 The Formal Denition of a Vector Space

October 7, :8 WSPC/WS-IJWMIP paper. Polynomial functions are renable

8 Singular Integral Operators and L p -Regularity Theory

Review Smoothing Spatial Filters Sharpening Spatial Filters. Spatial Filtering. Dr. Praveen Sankaran. Department of ECE NIT Calicut.

Novel determination of dierential-equation solutions: universal approximation method

Can the sample being transmitted be used to refine its own PDF estimate?

Conjugate lter approach for shock capturing

Towards a Mathematical Theory of Super-resolution

DESIGNING CNN GENES. Received January 23, 2003; Revised April 2, 2003

Module 4. Multi-Resolution Analysis. Version 2 ECE IIT, Kharagpur

Comments on \Wavelets in Statistics: A Review" by. A. Antoniadis. Jianqing Fan. University of North Carolina, Chapel Hill

Contents. 2.1 Vectors in R n. Linear Algebra (part 2) : Vector Spaces (by Evan Dummit, 2017, v. 2.50) 2 Vector Spaces

1 Introduction Duality transformations have provided a useful tool for investigating many theories both in the continuum and on the lattice. The term

(z) UN-1(z) PN-1(z) Pn-1(z) - z k. 30(z) 30(z) (a) (b) (c) x y n ...

Chapter 7 Interconnected Systems and Feedback: Well-Posedness, Stability, and Performance 7. Introduction Feedback control is a powerful approach to o

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

Analog Neural Nets with Gaussian or other Common. Noise Distributions cannot Recognize Arbitrary. Regular Languages.

Elec4621 Advanced Digital Signal Processing Chapter 11: Time-Frequency Analysis

Incorporating Prior Knowledge on Features into Learning

Hypergeometric Filters For Optical Flow and Ane Matching. Carnegie Mellon University. Pittsburgh, PA matching problems.

Multiscale Image Transforms

Region Description for Recognition

Digital Signal Processing, Homework 1, Spring 2013, Prof. C.D. Chung

output dimension input dimension Gaussian evidence Gaussian Gaussian evidence evidence from t +1 inputs and outputs at time t x t+2 x t-1 x t+1

Lie Groups for 2D and 3D Transformations

Machine Learning for Large-Scale Data Analysis and Decision Making A. Neural Networks Week #6

Digital Image Processing

Object Recognition Using a Neural Network and Invariant Zernike Features

window operator 2N N orthogonal transform N N scalar quantizers

2800 Lyngby, Denmark, Abstract

Edge Detection PSY 5018H: Math Models Hum Behavior, Prof. Paul Schrater, Spring 2005

Degradable Agreement in the Presence of. Byzantine Faults. Nitin H. Vaidya. Technical Report #

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

Νεςπο-Ασαυήρ Υπολογιστική Neuro-Fuzzy Computing

Rate-Distortion Based Temporal Filtering for. Video Compression. Beckman Institute, 405 N. Mathews Ave., Urbana, IL 61801

Introduction to Linear Systems

ICML '97 and AAAI '97 Tutorials

Deep Learning: Self-Taught Learning and Deep vs. Shallow Architectures. Lecture 04

Linear Operators and Fourier Transform

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Wavelet Transform in Similarity Paradigm I. Z.R. Struzik, A.P.J.M. Siebes

Super-resolution via Convex Programming

Automatic Capacity Tuning. of Very Large VC-dimension Classiers. B. Boser 3. EECS Department, University of California, Berkeley, CA 94720

Neural Networks. Single-layer neural network. CSE 446: Machine Learning Emily Fox University of Washington March 10, /9/17

Polynomial Solutions of the Laguerre Equation and Other Differential Equations Near a Singular

On Mean Curvature Diusion in Nonlinear Image Filtering. Adel I. El-Fallah and Gary E. Ford. University of California, Davis. Davis, CA

56 CHAPTER 3. POLYNOMIAL FUNCTIONS

Minimum and maximum values *

University oftoronto, Toronto, Ontario M5S 3H5. we eliminate the need to estimate the scale of the covariance

Rotation Invariant Texture Description obtained by General Moment Invariants A. Dimai Communications Technology Laboratory Swiss Federal Institute of

Calculus and linear algebra for biomedical engineering Week 3: Matrices, linear systems of equations, and the Gauss algorithm

SGD and Deep Learning

Vector Space Basics. 1 Abstract Vector Spaces. 1. (commutativity of vector addition) u + v = v + u. 2. (associativity of vector addition)

FOURIER TRANSFORMS. At, is sometimes taken as 0.5 or it may not have any specific value. Shifting at

IEEE Transactions on Information Theory, Vol. 41, pp. 2094{2100, Nov Information Theoretic Performance of Quadrature Mirror Filters.

Projection-invariant pattern recognition with a phase-only logarithmic-harmonic-derived filter

Introduction to Deep Learning

Linear Least-Squares Data Fitting

DESIGN OF MULTI-DIMENSIONAL DERIVATIVE FILTERS. Eero P. Simoncelli

2 optimal prices the link is either underloaded or critically loaded; it is never overloaded. For the social welfare maximization problem we show that

David Sagan. The standard analysis for a coupled lattice is based upon the formalism of Edwards

Deep Belief Networks are compact universal approximators

Convolution and Linear Systems

The error-backpropagation algorithm is one of the most important and widely used (and some would say wildly used) learning techniques for neural

This material is based upon work supported under a National Science Foundation graduate fellowship.

Lecture 3 Feedforward Networks and Backpropagation

Filtering and Edge Detection

Equations (3) and (6) form a complete solution as long as the set of functions fy n (x)g exist that satisfy the Properties One and Two given by equati

Linear Regression and Its Applications

Statistical Pattern Recognition

ECE533 Digital Image Processing. Embedded Zerotree Wavelet Image Codec

The XOR problem. Machine learning for vision. The XOR problem. The XOR problem. x 1 x 2. x 2. x 1. Fall Roland Memisevic

TinySR. Peter Schmidt-Nielsen. August 27, 2014

Filter Banks with Variable System Delay. Georgia Institute of Technology. Atlanta, GA Abstract

The Discrete Fourier Transform (DFT) Properties of the DFT DFT-Specic Properties Power spectrum estimate. Alex Sheremet.

Multidimensional signal compression using multiscale recurrent patterns

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

Probabilistic Model of Error in Fixed-Point Arithmetic Gaussian Pyramid

A POPULATION-MIX DRIVEN APPROXIMATION FOR QUEUEING NETWORKS WITH FINITE CAPACITY REGIONS

Neural networks and optimization

Introduction to Natural Computation. Lecture 9. Multilayer Perceptrons and Backpropagation. Peter Lewis

6 The Fourier transform

f(z)dz = 0. P dx + Qdy = D u dx v dy + i u dy + v dx. dxdy + i x = v

Reading. 3. Image processing. Pixel movement. Image processing Y R I G Q

DEEP LEARNING CHAPTER 3 PROBABILITY & INFORMATION THEORY

f(x) cos dx L L f(x) sin L + b n sin a n cos

Case Studies of Logical Computation on Stochastic Bit Streams

Function approximation

2 Tikhonov Regularization and ERM


Neural Networks Learning the network: Backprop , Fall 2018 Lecture 4

LECTURE 15 + C+F. = A 11 x 1x1 +2A 12 x 1x2 + A 22 x 2x2 + B 1 x 1 + B 2 x 2. xi y 2 = ~y 2 (x 1 ;x 2 ) x 2 = ~x 2 (y 1 ;y 2 1

Edge Detection. Introduction to Computer Vision. Useful Mathematics Funcs. The bad news

COS 424: Interacting with Data

Transcription:

Boxlets: a Fast Convolution Algorithm for Signal Processing and Neural Networks Patrice Y. Simard, Leon Bottou, Patrick Haner and Yann LeCun AT&T Labs-Research 100 Schultz Drive, Red Bank, NJ 07701-7033 patrice@microsoft.com fleonb,haner,yanng@research.att.com Abstract Signal processing and pattern recognition algorithms make extensive use of convolution. In many cases, computational accuracy is not as important as computational speed. In feature extraction, for instance, the features of interest in a signal are usually quite distorted. This form of noise justies some level of quantization in order to achieve faster feature extraction. Our approach consists of approximating regions of the signal with low degree polynomials, and then dierentiating the resulting signals in order to obtain impulse functions (or derivatives of impulse functions). With this representation, convolution becomes extremely simple and can be implemented quite eectively. The true convolution can be recovered by integrating the result of the convolution. This method yields substantial speed up in feature extraction and is applicable to convolutional neural networks. 1 Introduction In pattern recognition, convolution is an important tool because of its translation invariance properties. Feature extraction is a typical example: The distance between a small pattern (i.e. feature) is computed at all positions (i.e. translations) inside a larger one. The resulting \distance image" is typically obtained by convolving the feature template with the larger pattern. In the remainder of this paper we will use the terms image and pattern interchangeably (because of the topology implied by translation invariance). There are many ways to convolve images eciently. For instance, a multiplication of images of the same size in the Fourier domain corresponds to a convolution of the two images in the original space. Of course this requires KN log N operations (where N is the number of pixels of the image and K is a constant) just to go in and out of the Fourier domain. These methods are usually not appropriate for feature extraction because the feature to be extracted is small with respect to the image. For instance, if the image and the feature have respectively 32 32 and 5 5 pixels, Now with Microsoft, One Microsoft Way, Redmond, WA 98052

the full convolution can be done in 25 1024 multiply-adds. In contrast, it would require 2 K 1024 10 to go in and out of the Fourier domain. Fortunately, in most pattern recognition applications, the interesting features are already quite distorted when they appear in real images. Because of this inherent noise, the feature extraction process can usually be approximated (to a certain degree) without aecting the performance. For example, the result of the convolution is often quantized or thresholded to yield the presence and location of distinctive features [1]. Because precision is typically not critical at this stage (features are rarely optimal, thresholding is a crude operation), it is often possible to quantize the signals before the convolution with negligible degradation of performance. The subtlety lies in choosing a quantization scheme which can speed up the convolution while maintaining the same level of performance. We now introduce the convolution algorithm, from which we will deduce the constraints it imposes on quantization. The main algorithm introduced in this paper is based on a fundamental property of convolutions. Assuming that f and g have nite support and that f n denotes the n-th integral of f (or the n-th derivative if n is negative), we can write the following convolution identity: (f g) n = f n g = f g n (1) where denotes the convolution operator. Note that f or g are not necessarily dierentiable. For instance, the impulse function (also called Dirac delta function), denoted, veries the identity: a n m b = m+n a+b (2) where a n denotes the n-th integral of the delta function, translated by a ( a (x) = (x? a)). Equations 1 and 2 are not new to signal processing. Heckbert has developed an eective ltering algorithm [2] where the lter g is a simple combination of polynomial of degree n? 1. Convolution between a signal f and the lter g can be written as f g = f n g?n (3) where f n is the n-th integral of the signal, and the n-th derivative of the lter g can be written exclusively with delta functions (resulting from dierentiating n? 1 degree polynomials n times). Since convolving with an impulse function is a trivial operation, the computation of Equation 3 can be carried out eectively. Unfortunately, Heckbert's algorithm is limited to simple polynomial lters and is only interesting when the lter is wide and when the Fourier transform is unavailable (such as in variable length lters). In contrast, in feature extraction, we are interested in small and arbitrary lters (the features). Under these conditions, the key to fast convolution is to quantize the images to combinations of low degree polynomials, which are dierentiated, convolved and then integrated. The algorithm is summarized by equation: f g F G = (F?n G?m ) m+n (4) where F and G are polynomial approximation of f and g, such that F?n and G?m can be written as sums of impulse functions and their derivatives. Since the convolution F?n G?m only involves applying Equation 2, it can be computed quite eectively. The computation of the convolution is illustrated in Figure 1. Let f and g be two arbitrary 1-dimensional signals (top of the gure). Let's assume that f and g can both be approximated by partitions of polynomials, F and G. On the gure, the polynomials are of degree 0 (they are constant), and are depicted in the second line. The details on how to compute F and G will be explained in the next section. In the next step, F and G are dierentiated once, yielding successions of impulse functions (third line in the gure). The impulse representation has the advantage of having a nite support, and of being easy to convolve. Indeed two impulse functions can be convolved using Equation 2 (4 3 = 12 multiply-adds on the gure). Finally the result of the convolution must be integrated twice to yield F G = (F?1 G?1 ) 2 (5)

Original f g Quantization F G Differentiation F G F *G Convolution Double Integration F*G Figure 1: Example of convolution between 1-dimensional function f and g, where the approximations of f and g are piecewise constant. 2 Quantization: from Images to Boxlets The goal of this section is to suggest ecient ways to approximate an image f by cover of polynomials of degree d suited for convolution. Let S be the space on which S T f is dened, and let C = fc i g be a partition of S (c i cj = ; for i 6= j, and i c i = S). For each c i, let p i be a polynomial of degree d which minimizes equation: Z e i = x2c i (f(x)? p i (x)) 2 dx (6) The uniqueness of p i is guaranteed if c i is convex. The problem is to nd a cover C which minimizes both the number of c i and P i e i. Many dierent compromises are possible, but since the computational cost of the convolution is proportional to the number of regions, it seemed reasonable to chose the largest regions with a maximum error bounded by a threshold K. Since each region will be dierentiated and integrated along the directions of the axes, the boundaries of the c i s are restricted to be parallel to the axes, hence the appellation boxlet. There are still many ways to compute valid partitions of boxlets and polynomials. We have investigated two very dierent approaches which both yield a polynomial cover of the image in reasonable time. The rst algorithm is greedy. It uses a procedure which, starting from a top left corner, nds the biggest boxlet c i which satises e i < K without overlapping another boxlet. The algorithm starts with the top left corner of the image, and keeps a list of all possible starting points (uncovered top left corners) sorted by X and Y positions. When the list is exhausted, the algorithm terminates. Surprisingly, this algorithm can run in O(d(N + P log N)), where N is the number of pixels, P is the number of boxlets and d is the order of the polynomials p i s. Another much simpler algorithm consists of recursively splitting boxlets, starting from a boxlet which encompass the whole image, until e i < K for all the leaves of the tree. This algorithm runs in O(dN), is much easier to implement, and is faster (better time constant). Furthermore, even though the rst algorithm yields a polynomial coverage with less boxlets, the second algorithm yields less impulse functions after dierentiation because more impulse functions can be combined (see next section). Both algorithms rely on the fact that Equation 6 can be computed

Figure 2: Eects of boxletization: original (top left), greedy (bottom left) with a threshold of 10,000, and recursive (top and bottom right) with a threshold of 10,000. in constant time. This computation requires the following quantities X X f(x; y); f(x; y) 2 ; {z } degree 0 X X X f(x; y)x; f(x; y)y; {z } degree 1 f(x; y)xy; : : : (7) to be pre-computed over the whole image, for the greedy algorithm, or over recursively embedded regions, for the recursive algorithm. In the case of the recursive algorithm these quantities are computed bottom up and very eciently. To prevent the sums to become too large a limit can be imposed on the maximum size of c i. The coecients of the polynomials are quickly evaluated by solving a small linear system using the rst two sums for polynomials of degree 0 (constants), the rst 5 sums for polynomials of degree 1, and so on. Figure 2 illustrates the results of the quantization algorithms. The top left corner is a fraction of the original image. The bottom left image illustrates the boxletization of the greedy algorithm, with polynomials of degree 1, and e i <= 10; 000 ( 13000 boxlets, 62000 impulse (and its derivative) functions. The top right image illustrates the boxletization of the recursive algorithm, with polynomials of degree 0 and e i <= 10; 000 ( 47000 boxlets, 58000 impulse functions). The bottom right is the same as top right without displaying the boxlet boundaries. In this case the pixel to impulse function ratio 5.8. 3 Dierentiation: from Boxlets to Impulse Functions If p i is a polynomial of degree d, its (d + 1)-th derivative can be written as a sum of impulse function's derivatives, which are zero everywhere but at the corners of c i. These impulse functions summarize the boundary conditions and completely characterize p i. They can be represented by four (d + 1)-dimensional vectors associated with the 4 corners of c i. Figure 3 (top) illustrates the impulse functions at the 4

Polynomial (constant) X derivative Y derivative (of X derivative) Polynomial covering (constants) Derivatives Combined Sorted list representation Figure 3: Dierentiation of a constant polynomial in 2D (top). derivative of adjacent polynomials (bottom) Combining the corners when the polynomial is a constant (degree zero). Note that the polynomial must be dierentiated d + 1 times (in this example the polynomial is a constant, so d = 0), with respect to each dimension of the input space. This is illustrated at the top of Figure 3. The cover C being a partition, boundary conditions between adjacent squares do simplify, that is, the same derivatives of a impulse functions at the same location can be combined by adding their coecients. It is very advantageous to do so because it will reduce the computation of the convolution in the next step. This is illustrated in Figure 3 (bottom). This combining of impulse functions is one of the reason why the recursive algorithm for the quantization is preferred to the greedy algorithm. In the recursive algorithm, the boundaries of boxlets are often aligned, so that the impulse functions of adjacent boxlets can be combined. Typically, after simplication, there are only 20% more impulse functions than there are boxlets. In contrast, the greedy algorithm generates up to 60% more impulse functions than boxlets, due to the fact that there are no alignment constraints. For the same threshold the recursive algorithm generates 20% to 30% less impulse functions than the greedy algorithm. Finding which impulse functions can be combined is a dicult task because the recursive representation returned by the recursive algorithm does not provide any means for matching the bottom of squares on one line, with the top of squares from below that line. Sorting takes O(P log P ) computational steps (where P is the number of impulse functions) and is therefore too expensive. A better algorithm is to visit the recursive tree and accumulate all the top corners into sorted (horizontal) lists. A similar procedure sorts all the bottom corners (also into horizontal lists). The horizontal lists corresponding to the same vertical positions can then be merged in O(P ) operations. The complete algorithm which quantizes an image of N pixels and returns sorted lists of impulse functions runs in O(dN) (where d is the degree of the polynomials). 4 Results The convolution speed of the algorithm was tested with feature extraction on the image shown on the top left of Figure 2. The image is quantized, but the feature is not. The feature is tabulated in kernels of sizes 5 5, 10 10, 15 15 and 20 20. If the kernel is decomposable, the algorithm can be modied to do two 1D convolutions instead of the present 2D convolution. The quantization of the image is done with constant polynomials, and with thresholds varying from 1,000 to 40,000. This corresponds to varying the pixel to impulse function ratio from 2.3 to 13.7. Since the feature is not quantized, these ratios correspond exactly to the ratios of number of multiply-adds for the standard convolution versus the boxlet convolution (excluding quantization and integration). The

Threshold Image Convolution kernel size Boxlets Impls f. Ratio 5x5 10x10 15x15 20x20 1,000 125,685 144,520 2.3 1.5 2.2 2.4 2.4 2.3 2.6 2.6 2.5 5,000 68,994 84.382 4.0 2.3 3.2 3.8 4.0 3.8 3.8 4.0 4.0 10,000 47,253 58,120 5.8 2.8 4.8 5.4 5.5 4.7 6.0 6.1 5.9 40,000 20,244 24,661 13.7 5.2 9.2 11.3 12.4 8.4 12.5 13.4 13.8 Table 1: Convolution speed-up factors Horizontal convolution (a) Convolution of runs (b) * * = = (c) (d)... Σ... Σ Figure 4: Run length X convolution actual speed up factors are summarized in Table 1. The four last columns indicate the measured time ratios between the standard convolution and the boxlet convolution. For each threshold value, the top line indicates the time ratio of standard convolution versus quantization, convolution and integration time for the boxlet convolution. The bottom line does not take into account the quantization time. The feature size was varied from 5 5 to 20 20. Thus with a threshold of 10,000 and a 5 5 kernel, the quantization ratio is 5.8, and the speed up factor is 2.8. The loss in image quality can be seen by comparing the top left and the bottom right images. If several features are extracted, the quantization time of the image is shared amongst the features and the speed up factor is closer to 4.7. It should be noted that these speed up factors depend on the quantization level which depends on the data and aects the accuracy of the result. The good news is that for each application the optimal threshold (the maximum level of quantization which has negligible eect on the result) can be evaluated quickly. Once the optimal threshold has been determined, one can enjoy the speed up factor. It is remarkable that with a quantization factor as low as 2.3, the speed up ratio can range from 1.5 to 2.3, depending on the number of features. We believe that this method is directly applicable to forward propagation in convolutional neural nets (although no results are available at this time). The next application shows a case where quantization has no adverse eect on the accuracy of the convolution, and yet large speed ups are obtained.

5 Binary images and run-length encoding The quantization steps described in Sections 2 and 3 become particularly simple when the image is binary. If the threshold is set to zero, and if only the X derivative is considered, the impulse representation is equivalent to run-length encoding. Indeed the position of each positive impulse function codes the beginning of a run, while the position of each negative impulses code the end of a run. The horizontal convolution can be computed eectively using the boxlet convolution algorithm. This is illustrated in Figure 4. In (a), the distance between two binary images must be evaluated for every horizontal position (horizontal translation invariant distance). The result is obtained by convolving each horizontal line and by computing the sum of each of the convolution functions. The convolution of two runs, is depicted in (b), while the summation of all the convolutions of two runs is depicted in (c). If an impulse representation is used for the runs (a rst derivative), each summation of a convolution between two runs requires only 4 additions of impulse functions, as depicted in (d). The result must be integrated twice, according to Equation 5. The speed up factors can be considerable depending on the width of the images (an order of magnitude if the width is 40 pixels), and there is no accuracy penalty. Boxlets on binary image Compact Dirac representation Figure 5: Binary image (left) and compact impulse function encoding (right). This speed up also generalizes to 2-dimensional encoding of binary images. The gain comes from the frequent cancellations of impulse functions of adjacent boxlets. The number of impulse functions is proportional to the contour length of the binary shapes. In this case, the boxlet computation is mostly an ecient algorithm for 2-dimensional run-length encoding. This is illustrated in Figure 5. As with runlength encoding, a considerable speed up is obtained for convolution, at no accuracy penalty cost. 6 Conclusion When convolutions are used for feature extraction, precision can often be sacri- ced for speed with negligible degradation of performance. The boxlet convolution method combines quantization and convolution to oer a continuous adjustable trade-o between accuracy and speed. In some cases (such as in relatively simple binary images) large speed ups can come with no adverse eects. The algorithm is directly applicable to the forward propagation in convolutional neural networks and in pattern matching when translation invariance results from the use of convolution. References [1] Yann LeCun and Yoshua Bengio, \Convolutional networks for images, speech, and time-series," in The Handbook of Brain Theory and Neural Networks, M. A. Arbib, Ed. 1995, MIT Press. [2] Paul S. Heckbert, \Filtering by repeated integration," in ACM SIGGRAPH conference on Computer graphics, Dallas, TX, August 1986, vol. 20, pp. 315{ 321.