2,103 questions
-1
votes
1
answer
79
views
Having trouble adjusting Gaussian blur strength and understanding 1D Gaussian kernel generation
I’m implementing a Gaussian filter, but I’m struggling with a few parts of the process. Here’s my code so far:
def convolve(img, kernel):
#Get properties
row, column = img.shape
diff = ...
1
vote
2
answers
168
views
2D matrix convolution with convolve() in R
I am trying to perform 2D matrix processing (convolution) by applying a kernel/filter to a large matrix. There is a built-in function convolve that can perform convolution. It offers three different ...
1
vote
1
answer
130
views
Torch Conv2d results in both dimensions convolved
I have input shape to a convolution (50, 1, 7617, 10). Here, 7617 is word vectors as rows, and 10 is the number of words in columns. I want to convolve column-wise and obtain (2631, 1, 7617, 1), 1 ...
0
votes
0
answers
64
views
What is the fastest way to compute a filter in Fourier space?
I am currently working on a beam propagation code. The code basically consists of a transversal profile (a 2000x2000 array) which is propagated a small distance, then has its borders filtered, then ...
0
votes
0
answers
78
views
Tensorflow speed of tf.nn.conv2D used instead of opencv GaussianBlur
I'm trying to move some computer vision tasks to tensorflow. The most intensive ops are convolutions, like GaussianBlur. The timings I get using timeit suggest that the GPU equivalent is >10 x ...
0
votes
0
answers
67
views
Why is my OpenCL optimized convolution kernel slower than the naive version at higher workgroup sizes?
I'm working on a GPU-accelerated 2D convolution in OpenCL for a 2048x2048 image using a 3x3 Sobel filter. I implemented two versions of the kernel:
A naive version that uses only global memory.
An ...
0
votes
0
answers
35
views
improve the performance of time-shifted design matrix function using PyTorch
I am using the following function to create a design matrix that is then used as input in a linear model.
import numpy as np
import torch
def _compute_shifted(
feats_t: torch.Tensor,
delays: ...
0
votes
0
answers
33
views
Pytorch Unfold equivalent for sparse matrixes?
I'm making a convolution (1D, 2D and 3D) implementation that applies im2col (The unfold operation in the PyTorch library) to a zero-padded kernel instead of the input, to then multiply to the ...
1
vote
1
answer
92
views
Using scipy.ndimage.correlate only calculate elements with full overlap
I am trying to use scipy.ndimage.correlate to replicate the output of IDL convol() function. The IDL function only calculates elements where there is full overlap between the input and the kernel.
So, ...
1
vote
1
answer
114
views
Why is the convolution of two different frequency sine waves not 0? (Windowing help)
I'm trying to figure out how to window two different frequency sine waves in such a way that their convolution produces a 0 signal.
I have code that works for sine waves with integer periods:
T = 1000
...
0
votes
0
answers
40
views
How to convolve a 3D array with Lorentzian kernel along axis=2?
I have an array img_data of shape (x, x, n_channels) and I want to convolve / smooth along the axis=2.
Specifically, I would like the output shape to be (x,x,n_channels//3), after convolving the ...
0
votes
0
answers
29
views
Conv1d vs conv2d
I have several images for one sample. These images are picked randomly by tiling a high-dimensional bigger image. Each image is represented by a 512-dim vector (using ResNet18 to extract features). ...
1
vote
1
answer
113
views
Separable convolutions in PyTorch (i.e. 2 1D-vector-tensor "traditional" convolutions)
I'm trying to implement an image filter in PyTorch that takes in two filters of shapes (1,3), (3,1) that build up a filter of (3,3). An example application of this is the Sobel filter or Gaussian ...
2
votes
1
answer
157
views
CuPy ndimage convolution in a nested for-loop seems fast but the next execution is stalled
I am trying to write code that convolves a 3D image with a 3D wavelet kernel that can be described using three independent parameters. I want to analyze the results of the convolution for all ...
1
vote
1
answer
124
views
Convolving with a gaussian kernel vs Gaussian blur
While looking for a way to generate spatially varying noise, I came across this answer, which is able to do what I wanted. But I am getting confused about how the code works.
From what I understand, ...