All Projects → andrewliao11 → Dni.pytorch

andrewliao11 / Dni.pytorch

Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Dni.pytorch

Lsoftmax Pytorch
The Pytorch Implementation of L-Softmax
Stars: ✭ 133 (+19.82%)
Mutual labels:  classification, mnist
Randwire tensorflow
tensorflow implementation of Exploring Randomly Wired Neural Networks for Image Recognition
Stars: ✭ 29 (-73.87%)
Mutual labels:  classification, mnist
Pytorch Classification Uncertainty
This repo contains a PyTorch implementation of the paper: "Evidential Deep Learning to Quantify Classification Uncertainty"
Stars: ✭ 59 (-46.85%)
Mutual labels:  classification, mnist
Dataset
Crop/Weed Field Image Dataset
Stars: ✭ 98 (-11.71%)
Mutual labels:  classification
Augmentedgaussianprocesses.jl
Gaussian Process package based on data augmentation, sparsity and natural gradients
Stars: ✭ 99 (-10.81%)
Mutual labels:  classification
Gpstuff
GPstuff - Gaussian process models for Bayesian analysis
Stars: ✭ 106 (-4.5%)
Mutual labels:  classification
Natural Synaptic
Javascript Natural Language Classifier
Stars: ✭ 110 (-0.9%)
Mutual labels:  classification
Generative Models
Comparison of Generative Models in Tensorflow
Stars: ✭ 96 (-13.51%)
Mutual labels:  mnist
Mnist Classification
Pytorch、Scikit-learn实现多种分类方法,包括逻辑回归(Logistic Regression)、多层感知机(MLP)、支持向量机(SVM)、K近邻(KNN)、CNN、RNN,极简代码适合新手小白入门,附英文实验报告(ACM模板)
Stars: ✭ 109 (-1.8%)
Mutual labels:  mnist
Neuroflow
Artificial Neural Networks for Scala
Stars: ✭ 105 (-5.41%)
Mutual labels:  classification
Bert Relation Classification
A pytorch implementation of BERT-based relation classification
Stars: ✭ 103 (-7.21%)
Mutual labels:  classification
Segmentation
Tensorflow implementation : U-net and FCN with global convolution
Stars: ✭ 101 (-9.01%)
Mutual labels:  classification
Edafa
Test Time Augmentation (TTA) wrapper for computer vision tasks: segmentation, classification, super-resolution, ... etc.
Stars: ✭ 107 (-3.6%)
Mutual labels:  classification
Universal Data Tool
Collaborate & label any type of data, images, text, or documents, in an easy web interface or desktop app.
Stars: ✭ 1,356 (+1121.62%)
Mutual labels:  classification
Pointnet Keras
Keras implementation for Pointnet
Stars: ✭ 110 (-0.9%)
Mutual labels:  classification
Happy Transformer
A package built on top of Hugging Face's transformer library that makes it easy to utilize state-of-the-art NLP models
Stars: ✭ 97 (-12.61%)
Mutual labels:  classification
Keras Cloud Ml Engine
Adventures using keras on Google's Cloud ML Engine
Stars: ✭ 106 (-4.5%)
Mutual labels:  mnist
Matex
Machine Learning Toolkit for Extreme Scale (MaTEx)
Stars: ✭ 104 (-6.31%)
Mutual labels:  mnist
Fine grained classification
Fined grained classification On Car dataset
Stars: ✭ 103 (-7.21%)
Mutual labels:  classification
Onenotetaggingkit
OneNote (desktop) add-in to manage OneNote pages by page tags
Stars: ✭ 106 (-4.5%)
Mutual labels:  classification

disclaimer: this code is modified from pytorch-tutorial

Image classification with synthetic gradient in Pytorch

I implement the Decoupled Neural Interfaces using Synthetic Gradients in pytorch. The paper uses synthetic gradient to decouple the layers among the network, which is pretty interesting since we won't suffer from update lock anymore. I test my model in mnist and almost the same performance, compared to the model updated with backpropagation.

Requirement

  • pytorch
  • python 3.5
  • torchvision
  • seaborn (optional)
  • matplotlib (optional)

TODO

  • use multi-threading on gpu to analyze the speed

What's synthetic gradients?

We ofter optimize NN by backpropogation, which is usually implemented in some well-known framework. However, is there another way for the layers in NN to communicate with other layers? Here comes the synthetic gradients! It gives us a way to allow neural networks to communicate, to learn to send messages between themselves, in a decoupled, scalable manner paving the way for multiple neural networks to communicate with each other or improving the long term temporal dependency of recurrent networks.
The neuron in each layer will automatically produces an error signal(δa_head) from synthetic-layers and do the optimzation. And how did the error signal generated? Actually, the network still does the backpropogation. While the error signal(δa) from the objective function is not used to optimize the neuron in the network, it is used to optimize the error signal(δa_head) produced by the synthetic-layer. The following is the illustration from the paper:

Result

Feed-Forward Network

Achieve accuracy=96% (compared to the original model, which with accuracy=97%)

classify loss gradient loss(log level)
cDNI classify loss cDNI gradient loss(log level)

Convolutional Neural Network

Achieve accuracy=96%, (compared to the original model, which with accuracy=98%)

classify loss gradient loss(log level)

Usage

Right now I just implement the FCN, CNN versions, which are set as the default network structure.

Run network with synthetic gradient:

python main.py --model_type mlp

or

python main.py --model_type cnn

Run network with conditioned synthetic gradient:

python main.py --model_type mlp --conditioned True

Run vanilla network, from pytorch-tutorial

python mlp.py

or

python cnn.py

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].