Topic: 2D convolutions play an extremely important role in machine learning, as they form the first layers of Convolutional Neural Networks (CNNs). They are also very important for computer vision (template matching through correlation, correlation trackers) and in image processing (image filtering/denoising/restoration). 3D convolutions are very important for machine learning (video analysis through CNNs) and for video filtering/denoising/restoration.

Therefore, 2D/3D convolution algorithms are very important both for machine learning and for signal/image/video processing and analysis. As their computational complexity is of the order O(N^4) and O(N^6) respectively their fast execution is a must.

Exercise: CUDA Implementation in PyCUDA and C CUDA of a 2D Convolution between an image and several blurring and edge detection kernels.

The convolution is executed both in CPU (python code) and GPU (CUDA kernel) for execution time comparison purposes.

Instructions and Material for solution:

Exercise files include:

  • Conv2DpyCuda_v3.ipynb
  • Conv2DCudaC.ipynb
  • kernel_v2.cu
  • test.jpg

Download the test image and the CUDA code here.

Lecture for better understanding: https://icarus.csd.auth.gr/fast-2d-convolutions-algorithms-lecture/

————————————————————————————————————–——–

For the solutions to the exercises, please contact koroniioanna@csd.auth.gr