Skip to content

Implementation of Artificial Neural Network (ANN) from scratch to classify whether given image is Food/Non-Food.

Notifications You must be signed in to change notification settings

abhishk12/Implementing-ANN-from-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Implementation of Artificial Neural Network (ANN) from Scratch

This project is intended to learn Deep Learning core concepts. I've also deployed the same project by using CNN algorithm and tensorflow API. You can find the deployed project here.

Introduction

In this project, I've implemented a Food/Non-food binary classification using Artificial Neural Network (ANN) from scratch. This project is taken from Kaggle Datasets but the dataset is also available at this link. The images used for the dataset are scaled down to size of 64 X 64 X 3 and the model has 3 hidden layers and one output layer using sigmoid activation function. After evaluating the model gave an accuracy of 75.0%.

Dataset

The dataset used for the project is Food-5K. This is a dataset containing 2500 food and 2500 non-food images. The whole dataset is divided in three parts: training, validation and evaluation. The naming convention is as follows:

{ClassID}_{ImageID}.jpg

ClassID: 0 or 1; 0 means non-food and 1 means food.

ImageID: ID of the image within the class.

Data Preprocessing

The first step in data preprocessing is to convert the image into array of numbers which was done using OpenCV's cv2.imread() function. After the conversion, the image was then resized to shape of 64 X 64 X 3. Then the array was flattened to achieve a shape of 64*64*3 = (12288,m) where "m" is the number of training examples. The last step in data preprocessing is to normalize the values in the flattened array. The normalization is done by dividing the array by 255.

Modelling

While initializing the parameters, I've used "He weight initialization" which simply multiplies the weights by sqrt(2 / (No._of_neurons_in_previous_layer)).

About

Implementation of Artificial Neural Network (ANN) from scratch to classify whether given image is Food/Non-Food.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published