/convolution_functions

Code that implements convolution functions used in Neural Networks from scratch without external libraries apart from Numpy

Primary LanguagePythonMIT LicenseMIT

Convolution Functions

This repository contains code that implements convolution functions used in Neural Networks from scratch without use of external libraries/packages other than Numpy.

This was done as an exercise to get an intuition of the underlying implementation used in Convolutional Neural Network, specifically performing convolution and pooling. So please take in account that this code was written in a few days without any professional review/standard.

Getting Started

All the code can be found in "convolution.py". This file contains function to perform:

  • greyscale convolution
  • rgb convolution
  • max pooling
  • average pooling

There is also a "examples.py" to run some examples of the convolution functions on the two images (4.1.07.tiff, 5,1,09.tiff).

Prerequisites

Running the examples

Every example is separated into functions that can be called in a separate script by importing "examples.py"

You can run all the examples in one go this way:

python3 examples.py

Results

Greyscale convolution

moon moon convolved

Rgb convolution

candy candy convolved

Max pooling shrink

moon moon convolved

Max pooling blur

moon moon convolved

Max pooling stretch

moon moon convolved

Average pooling shrink

moon moon convolved

Average pooling blur

moon moon convolved

Average pooling stretch

moon moon convolved

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details