Note that there are some explanatory texts on larger screens.

plurals
  1. POFastest 2D convolution or image filter in Python
    primarykey
    data
    text
    <p>Several users have asked about the speed or memory consumption of image convolutions in numpy or scipy [<a href="https://stackoverflow.com/questions/2448015/2d-convolution-using-python-and-numpy">1</a>, <a href="https://stackoverflow.com/questions/5349521/python-image-filtering-with-pil-and-numpy-too-slow">2</a>, <a href="https://stackoverflow.com/questions/1100100/fft-based-2d-convolution-and-correlation-in-python">3</a>, <a href="https://stackoverflow.com/questions/2196693/improving-numpy-performance">4</a>]. From the responses and my experience using Numpy, I believe this may be a major shortcoming of numpy compared to Matlab or IDL. </p> <p>None of the answers so far have addressed the overall question, so here it is: "What is the fastest method for computing a 2D convolution in Python?" Common python modules are fair game: numpy, scipy, and PIL (others?). For the sake of a challenging comparison, I'd like to propose the following rules: </p> <ol> <li>Input matrices are 2048x2048 and 32x32, respectively.</li> <li>Single or double precision floating point are both acceptable.</li> <li>Time spent converting your input matrix to the appropriate format doesn't count -- just the convolution step.</li> <li>Replacing the input matrix with your output is acceptable (does any python library support that?)</li> <li>Direct DLL calls to common C libraries are alright -- lapack or scalapack</li> <li>PyCUDA is right out. It's not fair to use your custom GPU hardware. </li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload