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
0
votes
0 answers

Why is my AVX2 2D convolution as slow as my scalar implementation?

I tried optimizing my 2D convolution function using AVX2 but I'm not getting any speedup compared to my scalar implementation. On an input matrix of 8192*8192 with the iterations parameter (parameter only used for benchmarking) set to 10, I'm…
Tom Clabault
  • 481
  • 4
  • 18
0
votes
0 answers

mnist data set Interpolation

im working on MNIST data set using this formula :let I1 and I2 be images of two different digits,the interpolation D((E(I1)alpha)+(E(I2)(1-alpha))) for alpha [0,1] where D denotes the decoder and E the encode. here is my code : import torch import…
liza
  • 1
  • 1
0
votes
1 answer

memcpy argument memory ranges overlap when using MPI gather

I am trying to do image convolution in C using mpi. My idea is to divide the image into different chunks and let different process do different rank, and then gather them in a root process. I am quite new to C, can you guy explain for me the error…
0
votes
1 answer

Why is (cross) correlation not commutative in the field of image processing?

I am learning image processing, and everywhere people say that "convolution is commutative but correlation is not." (For example, see slides 19, 24, & 25 here) However, after searching I cannot find a good example that correlation is not…
0
votes
0 answers

Linear convolution and ifft doesn't give the same results

% Define the sequences x[n] and h[n] n = 0:3; x = cos(pi*n); h = 2*n; % Compute the four-point DFT of x[n] X = fft(x); % Compute the four-point DFT of h[n] H = fft(h); % Compute y[n] = x[n] * h[n] using linear convolution y_linear = conv(x,…
0
votes
0 answers

How to change the generator output size in a GAN (matlab)

I am trying to design a GAN using the example provided by matlab, however the data I'm using to train it are 150x105 grayscal images and in the example they are using 64x64 rgb. Could anyone sugest how can I change the output of the generator to…
0
votes
1 answer

How to speed up convolution with kernels that contain many zeros?

Suppose there are two set of kernels with a same shape and almost half elements in the kernels are zeros. For the same input x, the kernels are used to calculate convolution respectively. See pytorch example code blow: initial conv=nn.conv2d(c,n,k) …
0
votes
1 answer

Can I change the kernel at every pixel when performing a dilation in opencv?

I would like to dilate an image using a different kernel at each pixel. I was wondering if opencv supported this before I implement it myself. Essentially, I want to perform dilation with an ellipse structural element that is rotated depending on…
Cedric Martens
  • 1,139
  • 10
  • 23
0
votes
0 answers

Trying to find the distance of an object from a radar by 1) convolution 2) correlation[template matching] of sent and received signals in matlab

Hi and thank you for spare some time on reading this question. I have an assignment that is to find the distance of an object from a radar by 1) convolution 2) correlation[template matching] of sent and received signals which are rectangular…
0
votes
0 answers

Custom a convolution layer where each kernel-sized window is rotated by an angle

I want a convolution layer for an input image, with each sliding window gets rotated by a distinct angle (distinct angles for distinct windows) before convolution. For example, the input image has the size 100×100, and the kernel is 10×10. At a…
xc wang
  • 318
  • 1
  • 3
  • 14
0
votes
1 answer

Vectorizing S4 Class in R

I am trying to compute a log-likelihood, where the likelihood is a convolution of two distributions, and the distribution parameters depend on the value of that data point. More formally, I believe my data follows a likelihood which is the sum of…
0
votes
0 answers

How can we efficiently derive ANY inverse solution of a single convolutional layer?

Given a single convolutional layer h and its output y, how can one find any x' that satisfies h(x')=y efficiently? e.g. x->(conv2d)->y, where x∈R^{3*64*64}, y∈R^{64*32*32}, and conv2d:…
yongari38
  • 41
  • 1
  • 8
0
votes
1 answer

input and out put dont match in CNN

Im building CNN based on this data:https://en.wikipedia.org/wiki/CIFAR-10 , which consists of 10 object classes with 60000 32-by-32 RGB images in total (50000 training, 10000 test). what i want to do after building and training a CNN is to change…
liza
  • 1
  • 1
0
votes
1 answer

how to apply conv2d on masked elements in ndarray?

for example, I have a matrix 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 And a mask 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 here I have 3 elements that I want to apply conv2d on. The operation is I want to replace the element in the mask with the int average value of…
fgg1991
  • 65
  • 8
0
votes
1 answer

Implementing 2D-convolution in python

Im writing a project about convolutional neural network's and I need to implement an example of a convolution with a given input which is a 3x4-matrix and a 2x2 kernel. I already have the answer for this equation, which is the picture under. I…
Egelund48
  • 11
  • 1