1 Star 0 Fork 0

SimonChen / RandWireNN

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

MIT License Copyright (c) 2019 Myeongjun Kim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/SimonChenHere/RandWireNN.git
git@gitee.com:SimonChenHere/RandWireNN.git
SimonChenHere
RandWireNN
RandWireNN
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891