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.

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_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.

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

The following two images were produced using kernel_1.

The following two images were produced using kernel_4.

The following two images were produced using kernel_5.

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

Code. Debug. Repeat. Currently an SDE II at Amazon AI (AWS SageMaker Hosting). Always promoting curiosity, camaraderie and compassion. All opinions are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store