scipy.signal.convolve2d very slow, why is it there exactly?
Hi all, I had previously reported that signal.convolve2d was significantly slower than matlab for the following code: ------------- #!/usr/bin/python import scipy.io as io import scipy.signal aa=io.loadmat('input.mat') seq=aa["seq"] #seq_f=scipy.empty(seq.shape) seq_f=[] kernel=scipy.randn(21,21) for k in xrange(seq.shape[2]): seq_f.append(scipy.signal.convolve2d(seq[:,:,k],kernel,'same')) io.savemat("output_python2.mat",{"seq_f":seq_f}) ----------------- Turns out, I can get even better results than matlab by using fftconvolve instead of convolve2d. The generic signal.convolve gives intermediary results, a lot better than convolve2d but still slower than matlab. Here are the results of my measurements for anyone interested: convolve2d : 9 minutes convolve : 3 minutes matlab's conv2 : 1m2s fftconvolve : 35s So the question seems to be, why is convolve2d even there? It's very slow and limited to 2D arrays. It's misleading to newcommers who might very well conclude from its use that scipy is too slow to be useful.
participants (1)
-
Joel Schaerer