GithubHelp home page GithubHelp logo

pmoonesi / image-classification-mlp Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 113 KB

A simple multi layer perceptron model to classify images in CIFAR-10 dataset.

License: MIT License

Jupyter Notebook 100.00%
cifar-10 mlp-classifier

image-classification-mlp's Introduction

image-classification-mlp

This is the first project for the course Computational Intelligence - Spring 2022, Dr. Ebadzadeh

introduction

I used a 4 layer multilayered perceptron model to classify images in CIFAR-10 dataset (publicly available here).

For the model we have 1024 neurons for the input layer, 16 neurons for each of the two hidden layers and 4 neurons for output layer to be able to classify only 4 classes of CIFAR-10 dataset. For the activation function I used sigmoid in every layer and for the cost function I used sum of squared errors(SSE).

To train the model I used a stochastic gradient descent algorithm and implemented two methods to compute gradient; vectorized and non-vectorized.

preparing the data

Our model has 4 neurons in it's last layer so we needed to provide it with 4 classes of CIFAR-10 dataset. To do this, I used a function called load_cifar_10_data to load the cifar dataset. Then I extracted the data and their labels for the first four classes including cat, bird, automobile and airplane. For the model to be able to use this data, we first transform images to grayscale (otherwise we needed one neuron for each color, 3072 neurons in the first layer), then we flatten the images. After these operations we can use the data to train and test our model.

structure

You need to extract the CIFAR-10 dataset files into cifar-10-batches-py folder and have your structure like down below.

.
├── ...
├── cifar-10-batches-py                    
│   ├── batches.meta          
│   ├── data_batch_1  
│   ├── ...
│   ├── data_batch_5        
│   └── test_batch               
└── mlp.ipynb

how to run

pip install notebook
jupyter notebook

image-classification-mlp's People

Contributors

pmoonesi avatar

Stargazers

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