Giter Site home page Giter Site logo

maniraman-periyasamy / cnn-cpu Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 16.21 MB

This is a simple CNN CPU, GPU implementation where the model can be submitted as a Dictionary for the CPU and GPU version.

Python 100.00%
cnn cnn-classification cnn-cpu convolutional-neural-networks convolutional-neural-networks-cpu mnist-classification cnn-cpu-gpu-comparision cnn-from-scratch cnn-layer

cnn-cpu's Introduction

CNN-CPU

This is a simple implementation of Convolutional Neural Netowrk running in CPU, GPU to classify MNIST data where the model can be submitted as a python Dictionary for the CPU and GPU version.

Libraries Used

  1. tensorflow-gpu 2.2.0
  2. numpy 1.19.1
  3. matplotlib 3.3.1
  4. pandas 1.1.1

CPU version is done in Layer abstraction method so that any "Sequential" archticture can be constructed with the layers implemented.

CPU layers :

  1. CNN layer
  2. Fully Connected Layer
  3. Pooling Layer
  4. Initializers Layer (He, Xavier, Constant and Uniform)
  5. Dropout Layer
  6. TanH Layer
  7. Sigmoid Layer
  8. SoftMax Layer
  9. ReLU Layer
  10. Flatten Layer

Architecture of the model can be sent as a Dictionary with the parameters for each layer as shown below.

architecture = {

    "layers": [
        {
            "name": "CNN",
            "filters":5,
            "kernel_size": (5,5),
            "strides": (2,2),
            "padding": "valid",
            "activation": "relu",
            "input_shape": (28,28,1),
            "image_channels":1
        },
        {
            "name": "CNN",
            "filters":12,
            "kernel_size": (3,3),
            "strides": (1,1),
            "padding": "valid",
            "activation": "relu",
            "input_shape": (1,28,28),
            "image_channels":1
            
        },
        {
            "name": "pool",
            "pool_size": (2,2),
            "strides": (1,1),
            "input_shape": (1,28,28)
        },
        {
            "name": "dropout",
            "dropoutRate": 0.25
        },
        {
            "name": "Flatten"
        },
        {
            "name": "FC",
            "input_shape": 972,
            "outputSize": 128,
            "activation": "relu"
        },
        {
            "name": "dropout",
            "dropoutRate": 0.5
        },
        {
            "name": "FC",
            "input_shape": 128,
            "outputSize": num_classes,
            "activation": "softmax"
        },
    ],
}

To benchmark this against a Keras-GPU implementation a wrapper for Keras is written in GPU.py file so that the same architecture dictionary can be used for CPU and GPU.

cnn-cpu's People

Contributors

maniraman-periyasamy avatar

Stargazers

 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.