Implementing 2D Convolution

I implemented 2D Convolution from scratch in this project. (Link to Github Repo of Source Code) I recorded my output and performance results below.

The parameters associated with each of the tasks is given below.

PART A

The following two input images were used to carry out the 2d convolutions described in task A.

A Cartoon Image (1280 x 720)

A Checkerboard Image (1920 x 1080)

The output for part A is given below. The normalized output for part A is included at the end of the file.

Task 1

The following two images were produced using kernel_1. The checker board result indicates that kernel 1 functions as a form of horizontal edge detector.

Task 2

The following two images were produced using kernel_4.The checker board result indicates that kernel 4 also functions as a form of horizontal edge detector. We also observe that the edge detection is more pronounced in this case.

The following two images were produced using kernel_5. The checker board result indicates that kernel 5 functions as a form of vertical edge detector.

Task 3

Note that all the output images are smaller than the input image due to stride value being greater than 1.

The following two images were produced using kernel_1.The checker board result indicates that kernel 1 functions as a form of horizontal edge detector.

The following two images were produced using kernel_2. The checker board result indicates that kernel 2 functions as a form of vertical edge detector.

The following two images were produced using kernel_3. This kernel is supposed to be a smoothing filter.


PART B

Graphs showing the time taken for convolution as a function of the i Values (where 2^i = number of output channels), for each of the input images is given below.


PART C

Graphs showing the number of operations in the convolutions as a function of the given kernel sizes, for each of the input images is given below.


Normalized Output for PART A

Task 1

The following two images were produced using kernel_1.

Task 2

The following two images were produced using kernel_4.

The following two images were produced using kernel_5.

Task 3

The following two images were produced using kernel_1.

The following two images were produced using kernel_2.

The following two images were produced using kernel_3.

Written on April 6, 2018