Code Monkey home page Code Monkey logo

randwirenn's Introduction

Randomly Wired Neural Network

  • Implement Exploring Randomly Wired Neural Networks for Image Recognition :)

PWC Datasets Datasets

Experiments

Datasets Model Accuracy Epoch Training Time Model Parameters
CIFAR-10 RandWireNN(4, 0.75), c=78 93.61% 77 3h 50m 4.75M
CIFAR-10 RandWireNN(4, 0.75), c=109 94.03% 62 3h 50m 8.93M
CIFAR-10 RandWireNN(4, 0.75), c=154 94.23% 94 8h 40m 17.31M
CIFAR-100 RandWireNN(4, 0.75), c=78 73.63% 97 4h 46m 4.87M
CIFAR-100 RandWireNN(4, 0.75), c=109 75.00% 99 6h 9m 9.04M
CIFAR-100 RandWireNN(4, 0.75), c=154 75.42% 99 9h 32m 17.43M
IMAGENET WORK IN PROGRESS WORK IN PROGRESS

Update (2019.05.06)

  1. Visualize weights
  2. Add directory of Drop Connection regularization RandWireNN

Update (2019.04.20)

  1. I added graphing functions for train accuracy, test accuracy, and train loss.
  2. I have added a part to report learning time and accuracy. Reporting of the above results can be seen in the reporting folder.

Todo

  • Experiment with Imagenet dataset.
  • To implement Optimzier like the paper.

Plot

CIFAR-10

epoch_acc_plot

CIFAR-100

epoch_acc_plot_75퍼_CIFAR100

Visualize layer

img

  • As each Epoch passes, we can see that the feature map is formed around the object.

Run

python main.py
  • If you want to change hyper-parameters, you can check "python main.py --help"

Options:

  • --epochs (int) - number of epochs, (default: 100).
  • --p (float) - graph probability, (default: 0.75).
  • --c (int) - channel count for each node, (example: 78, 109, 154), (default: 78).
  • --k (int) - each node is connected to k nearest neighbors in ring topology, (default: 4).
  • --m (int) - number of edges to attach from a new node to existing nodes, (default: 5).
  • --graph-mode (str) - kinds of random graph, (exampple: ER, WS, BA), (default: WS).
  • --node-num (int) - number of graph node (default n=32).
  • --learning-rate (float) - learning rate, (default: 1e-1).
  • --model-mode (str) - which network you use, (example: CIFAR10, CIFAR100, SMALL_REGIME, REGULAR_REGIME), (default: CIFAR10).
  • --batch-size (int) - batch size, (default: 100).
  • --dataset-mode (str) - which dataset you use, (example: CIFAR10, CIFAR100, MNIST), (default: CIFAR10).
  • --is-train (bool) - True if training, False if test. (default: True).
  • --load-model (bool) - (default: False).

Test

python test.py
  • Put the saved model file in the checkpoint folder and saved graph file in the saved_graph folder and type "python test.py".
  • If you want to change hyper-parameters, you can check "python test.py --help"
  • The model file currently in the checkpoint folder is a model with an accuracy of 92.70%.

Options:

  • --p (float) - graph probability, (default: 0.75).
  • --c (int) - channel count for each node, (example: 78, 109, 154), (default: 78).
  • --k (int) - each node is connected to k nearest neighbors in ring topology, (default: 4).
  • --m (int) - number of edges to attach from a new node to existing nodes, (default: 5).
  • --graph-mode (str) - kinds of random graph, (exampple: ER, WS, BA), (default: WS).
  • --node-num (int) - number of graph node (default n=32).
  • --model-mode (str) - which network you use, (example: CIFAR10, CIFAR100, SMALL_REGIME, REGULAR_REGIME), (default: CIFAR10).
  • --batch-size (int) - batch size, (default: 100).
  • --dataset-mode (str) - which dataset you use, (example: CIFAR10, CIFAR100, MNIST), (default: CIFAR10).
  • --is-train (bool) - True if training, False if test. (default: False).

Reference

Methods

  • Erdos-Renyi (ER) Graph, Watts-Strogatz (WS) Graph and Barabasi-Albert (BA) Graph are all available.
  • If you want to visualize the network connection, you can follow the jupyter notebook in visualize_graph directory.
  • Label smoothing.
    • In CIFAR-10, The accuracy was 92.00%.
    • But, CIFAR-100, I have seen improvements in CIFAR-100.

Version

  • Windows 10, Pycharm community...
  • Python 3.7
  • Cuda 9.2
  • Cudnn 7.1.4
  • pytorch 1.0.1
  • networkx 2.2
  • torchviz 0.0.1
  • graphviz 0.10.1
  • tqdm 4.31.1
  • conda install cairo(If you want to visualize the network, it is a required module.)

Network Image

Small Network Image

  • It is a picture of the sample small network in the visualize_graph directory.
  • When I draw the contents of "Exploring Randomly Wired Neural Networks for Image Recognition" on the network, too many nodes are created. So I tried to draw a small network for visualization.
    • Number of nodes: 7
    • Graph parameters(probability P): 0.4
    • Random seed: 12
    • In_channels: 2
    • Out_channels: 2
  • The following figure is a simple example, and the basic RandWired NeuralNetwork Module is provided.

Example of Network

image

randwirenn's People

Contributors

leaderj1001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

randwirenn's Issues

BrokenPipeError: [Errno 32] Broken pipe

Are you sure that you run it on Windows 10 ?
i run it on Windows, this wrong message comes
this kind of message usually happen on Windows (not on Linux or Mac OS) because of PYTORCH's Multithreading Strategy on Win10

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.