Code Monkey home page Code Monkey logo

neuralgenetic's Introduction

NeuralGenetic

This project optimizes the artificial neural network (ANN) parameters using the genetic algorithm (GA) for the classification of the Fruits360 dataset. The implementation is from scratch using NumPy.

Part 1

This project is an extension to a previous project which is documented in a tutorial titled Artificial Neural Network Implementation using NumPy and Classification of the Fruits360 Image Dataset which is available at my LinkedIn profile here: https://www.linkedin.com/pulse/artificial-neural-network-implementation-using-numpy-fruits360-gad. It starts by extracting the image features from 4 selected classes of the Fruits360 dataset which are Apple Braeburn, Lemon Meyer, Mango, and Raspberry. The feature vector consisted of 360 bin histogram of the Hue channel.

The feature vector is reduced by filtering it using the standard deviation to return a new vector of length 102. The reduced feature vector is used for training the ANN that is implemented from scratch using NumPy. The implementation of the first tutorial is available at this link at my GitHub page: https://github.com/ahmedfgad/NumPyANN

In the previous project, the ANN was not completely created as just the forward pass was made ready but there is no backward pass for updating the network weights. This is why the accuracy is very low and not exceeds 45%. The solution to this problem is using an optimization technique for updating the network weights. This project uses the genetic algorithm (GA) for optimizing the network weights.

It is worth-mentioning that both the previous and this tutorial are based on my 2018 book cited as Ahmed Fawzy Gad 'Practical Computer Vision Applications Using Deep Learning with CNNs'. Dec. 2018, Apress, 978-1-4842-4167-7. The book is available at Springer at this link: https://springer.com/us/book/9781484241660. You can find all details within this book.

Part 2

The extension to the previous tutorial, which is implemented by this project, consists of 3 main Python files which are ANN.py, GA.py, and Example_GA_ANN.py which is the main file from which the other files are imported and called. This file uses 2 supplementary files which are the previously extracted dataset features stored into a file named dataset_features.pkl. The second file is the class labels for all samples which are stored into a file named outputs.pkl.

The Example_GA_ANN.py file reads the features and the class labels files, filters the features based on the standard deviation, creates the ANN architecture, generates the initial solutions, loops through a number of generations by calculating the fitness values for all solutions, selecting best parents, applying crossover and mutation, and finally creating the new population.

The documentartion of the second tutorial is available at my LinkedIn profile here: https://www.linkedin.com/pulse/artificial-neural-networks-optimization-using-genetic-ahmed-gad

Read more about GA

Before going further in this project, I recommend reading about the GA and its implementation in Python from scratch. You can find details it my book cited above. Also you can read my previous tutorials found at these links:

For contacting the author

neuralgenetic's People

Contributors

ahmedfgad avatar

Watchers

James Cloos avatar STYLIANOS IORDANIS avatar  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.