GithubHelp home page GithubHelp logo

allconvnet's Introduction

Image Classification using simpler CNN - AllConvNet

This repository contains implemenation of STRIVING FOR SIMPLICITY: THE ALL CONVOLUTIONAL NET on the CIFAR-10 Dataset

Image Preprocessing using ZA Whitening

ZCA Whitening procedure is as explained on this page Implementing PCA/Whitening

# Applying global contrast normalize followed by whitening
def global_contrast_normalize(input_x, scale=1., min_divisor=1e-8):
    input_x = input_x - input_x.mean(axis=1)[:, np.newaxis]
    normalizers = np.sqrt((input_x ** 2).sum(axis=1)) / scale
    normalizers[normalizers < min_divisor] = 1.
    input_x /= normalizers[:, np.newaxis]
    return input_x


def compute_zca_transform(images, filter_bias=0.1):
    mean_x = np.mean(images, 0)
    cov_x = np.cov(images.T)
    eigenvalues, eigenvectors = np.linalg.eigh(cov_x + filter_bias * np.eye(cov_x.shape[0], cov_x.shape[1]))
    assert not np.isnan(eigenvalues).any()
    assert not np.isnan(eigenvectors).any()
    assert eigenvalues.min() > 0
    eigenvalues = eigenvalues ** -0.5
    whiten = np.dot(eigenvectors, np.dot(np.diag(eigenvalues), eigenvectors.T))
    return mean_x, whiten


def zca_whiten(train, test, cache=None):
    if cache and os.path.isfile(cache):
        with open(cache, 'rb') as f:
            (mean_x, whiten) = pickle.load(f)
    else:
        mean_x, whiten = compute_zca_transform(train)

        with open(cache, 'wb') as f:
            pickle.dump((mean_x, whiten), f, 2)

    train_whiten = np.dot(train - mean_x, whiten)
    test_whiten = np.dot(test - mean_x, whiten)
    return train_whiten, test_whiten

Network Graphs for Model A, B and C

Network Structure

Model A ### Model B ### Model C

Network Model

All-CNN Model A

Accuracy
Model A

All-CNN Model B

Accuracy
Model B

All-CNN Model C

Accuracy
Model C

allconvnet's People

Contributors

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