Giter Site home page Giter Site logo

amir79naziri / neuralnetworkclassifier_project Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 21.5 MB

Implementing Fruit Classifier with FeedForward-NN From scratch.

Jupyter Notebook 84.64% Python 15.36%
classification image-classification feedforward-neural-network neural-networks deep-learning fruit360

neuralnetworkclassifier_project's Introduction

Neural Network Classifier

Table of Contents
  1. About The Project
  2. Usage
  3. Phases
  4. License
  5. Contact

About The Project

This project implements a feed-forward neural network from scratch with numpy and uses the 360 Fruits Dataset for training and testing model. there are seven phases in this project which complete neural network implementation step by step, which includes the following steps

As input data are images, so there are some feature extraction codes that can transform images into fixed dimensional vectors, so the model uses .pkl extension files as input (not direct images). In the beginning, non-vectorized backward propagation will be implemented, and after that implementation will be changed to vectorized backward propagation.

(back to top)

Usage

Requirements

Project uses numpy array for increasing speed and Linear algebra, then you should install numpy library

$ pip install numpy

also, project needs matplotlib for visualizing plots

$ pip install matplotlib

and you should install tqdm for better experince (you can delete it from code if you want)

$ pip install tqdm

(optional)
if you want to run feature extraction codes yourself, please install scikit-image too

$ pip install scikit-image

Run

Run all cells in order, but you should run phase 7 before running the train function's cell at phase 3.

(back to top)

Phases

Preprocess Data

In this phase data is transformed from images into vectors, at beginning feature extraction reads all images and with the use of histogram function and number of 360 bins, images are transformed into vectors, then features with specific standard deviation are deleted, and finally, data is ready!

Forward Propagation

In this phase forward function is implemented and weights and biases are initialized, also the test function is implemented for testing the accuracy of the model. As activation function, this model uses sigmoid for all layers.

Non-Vectorized Backward Propagetion

In this phase nonvectorized backward function is implemented, but it is so slow.

Vectorized Backward Propagetion

In this phase vectorized backward function is implemented, as you can see it is super fast.

Final Test


Hyperparameters Analyzing

Run cells to see effect of different hyperparameters on accuracy.

Learning Rate Decay

I used a custom learning decay for improving convergence.
class LR_Decay:
    def __init__(self, initial_lr, k):
        self.initial_lr = initial_lr
        self.t = 0
        self.k = k
        
    def step(self):
        value = self.initial_lr * np.exp(-self.k * self.t)
        self.t += 1
        return max(value, 1)

Deeper Network !!!

In the last phase, 3 fruits were added to the dataset, so there are seven fruits and also we need Deeper Model !!!
โš ๏ธ warning: feel free to add more fruits to the dataset, but you should modify feature extraction a little bit and make your model more complex.

(back to top)

License

Distributed under the MIT license. See LICENSE.md for more information.

(back to top)

Contact

Amirreza Naziri
Email: [email protected]

(back to top)

neuralnetworkclassifier_project's People

Contributors

amir79naziri avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.