Questions tagged [convolution]

A mathematical operation that combines two signals to generate a third signal. Convolution often arises in audio processing (e.g., filtering, reverb) and image processing (e.g., blurring, edge detection).

Convolution takes two signals and combines them to generate a third signal. For 1-D signals, the operation can be thought of as sliding the time-reverse of one signal along the other, and at each time step, taking the integral of the product of the signals (see wikipedia). The convolution operation describes the response of linear time-invariant systems to common input signals. Therefore, it commonly occurs in digital signal processing (DSP) contexts. Audio and image processing are two very common application areas for convolution.

A simple implementation for convolving two discrete time signals requires M*N multiply-add operations, where M and N are the lengths of the two signals. However, by taking advantage of the fact that convolution in the time domain is equivalent to multiplication in the frequency domain, and that transforming between domains can be implemented with O(N*log N) operations, convolution can be sped up. See here for more details.


Related tags

2052 questions
195
votes
4 answers

Intuitive understanding of 1D, 2D, and 3D convolutions in convolutional neural networks

Can anyone please clearly explain the difference between 1D, 2D, and 3D convolutions in convolutional neural networks (in deep learning) with the use of examples?
126
votes
4 answers

Tensorflow Strides Argument

I am trying to understand the strides argument in tf.nn.avg_pool, tf.nn.max_pool, tf.nn.conv2d. The documentation repeatedly says strides: A list of ints that has length >= 4. The stride of the sliding window for each dimension of the input…
93
votes
2 answers

Understanding NumPy's Convolve

When calculating a simple moving average, numpy.convolve appears to do the job. Question: How is the calculation done when you use np.convolve(values, weights, 'valid')? When the docs mentioned convolution product is only given for points where the…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
66
votes
4 answers

2-D convolution as a matrix-matrix multiplication

I know that, in the 1D case, the convolution between two vectors, a and b, can be computed as conv(a, b), but also as the product between the T_a and b, where T_a is the corresponding Toeplitz matrix for a. Is it possible to extend this idea to…
65
votes
4 answers

What does "ValueError: object too deep for desired array" mean and how to fix it?

I'm trying to do this: h = [0.2, 0.2, 0.2, 0.2, 0.2] Y = np.convolve(Y, h, "same") Y looks like this: While doing this I get this error: ValueError: object too deep for desired array Why is this? My guess is because somehow the convolve function…
Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
62
votes
5 answers

What is the number of filter in CNN?

I am currently seeing the API of theano, theano.tensor.nnet.conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, image_shape=None, **kwargs) where the filter_shape is a tuple of…
xxx222
  • 2,980
  • 5
  • 34
  • 53
50
votes
1 answer

What is the difference between UpSampling2D and Conv2DTranspose functions in keras?

Here in this code UpSampling2D and Conv2DTranspose seem to be used interchangeably. I want to know why this is happening. # u-net model with up-convolution or up-sampling and weighted binary-crossentropy as loss func from keras.models import…
48
votes
4 answers

Convolve2d just by using Numpy

I am studying image-processing using NumPy and facing a problem with filtering with convolution. I would like to convolve a gray-scale image. (convolve a 2d Array with a smaller 2d Array) Does anyone have an idea to refine my method? I know that…
Allosteric
  • 871
  • 1
  • 9
  • 14
44
votes
2 answers

Keras conv1d layer parameters: filters and kernel_size

I am very confused by these two parameters in the conv1d layer from keras: https://keras.io/layers/convolutional/#conv1d the documentation says: filters: Integer, the dimensionality of the output space (i.e. the number output of filters in the…
Ziqi
  • 2,445
  • 5
  • 38
  • 65
41
votes
3 answers

Activation function after pooling layer or convolutional layer?

The theory from these links show that the order of Convolutional Network is: Convolutional Layer - Non-linear Activation - Pooling Layer. Neural networks and deep learning (equation (125) Deep learning book (page 304, 1st paragraph) Lenet (the…
malioboro
  • 3,097
  • 4
  • 35
  • 55
37
votes
3 answers

Tensorflow: loss decreasing, but accuracy stable

My team is training a CNN in Tensorflow for binary classification of damaged/acceptable parts. We created our code by modifying the cifar10 example code. In my prior experience with Neural Networks, I always trained until the loss was very close to…
34
votes
2 answers

Convolutional Neural Network (CNN) for Audio

I have been following the tutorials on DeepLearning.net to learn how to implement a convolutional neural network that extracts features from images. The tutorial are well explained, easy to understand and follow. I want to extend the same CNN to…
33
votes
2 answers

Android: fast bitmap blur?

I've been searching the past three days for a built-in, hardware-accelerated way of bluring a bitmap with android. I stumbled upon certain work-arounds like shrinking the bitmap and scaling it up again, but this method produced low quality results…
theV0ID
  • 4,172
  • 9
  • 35
  • 56
31
votes
2 answers

How To Determine the 'filter' Parameter in the Keras Conv2D Function

I'm just beginning my ML journey and have done a few tutorials. One thing that's not clear (to me) is how the 'filter' parameter is determined for Keras Conv2D. Most sources I've read simply set the parameter to 32 without explanation. Is this…
31
votes
4 answers

How is a convolution calculated on an image with three (RGB) channels?

Say we have a single channel image (5x5) A = [ 1 2 3 4 5 6 7 8 9 2 1 4 5 6 3 4 5 6 7 4 3 4 5 6 2 ] And a filter K (2x2) K = [ 1 1 1 1 ] An example of applying convolution (let us take the first 2x2 from A) would…
Aragorn
  • 477
  • 1
  • 8
  • 12
1
2 3
99 100