一网打尽!深度学习100+经典模型TensorFlow与Pytorch代码实现大集合

2020 年 1 月 3 日 专知

【导读】深度学习在过去十年获得了极大进展,出现很多新的模型,并且伴随TensorFlow和Pytorch框架的出现,有很多实现,但对于初学者和很多从业人员,如何选择合适的实现,是个选择。rasbt在Github上整理了关于深度学习模型TensorFlow和Pytorch代码实现集合,含有100个,各种各样的深度学习架构,模型,和技巧的集合Jupyter Notebooks,从基础的逻辑回归到神经网络到CNN到GNN等,可谓一网打尽,值得收藏!


地址:

https://github.com/rasbt/deeplearning-models


传统机器学习


  • 感知器 Perceptron
       [TensorFlow 1: GitHub | Nbviewer]

    https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/perceptron.ipynb
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/perceptron.ipynb


  • 逻辑回归 Logistic Regression
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/logistic-regression.ipynb
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/logistic-regression.ipynb



  • Softmax Regression (Multinomial Logistic Regression)
       [TensorFlow 1: GitHub | Nbviewer]

    https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/softmax-regression.ipynb
       [PyTorch: GitHub | Nbviewer]

    https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/softmax-regression.ipynb


  • Softmax Regression with MLxtend's plot_decision_regions on Iris
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/softmax-regression-mlxtend-1.ipynb


多层感知器


  • 多层感知器 Multilayer Perceptron
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mlp/mlp-basic.ipynb
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-basic.ipynb


  • 带Dropout的多层感知器 Multilayer Perceptron with Dropout
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • 具有批处理规范化的多层感知器 Multilayer Perceptron with Batch Normalization
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • Multilayer Perceptron with Backpropagation from Scratch
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]


卷积神经网络



基础

  • 卷积神经网络 Convolutional Neural Network
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/cnn/cnn-basic.ipynb
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-basic.ipynb

  • Convolutional Neural Network with He Initialization
       [PyTorch: GitHub | Nbviewer]

Concepts

  • Replacing Fully-Connnected by Equivalent Convolutional Layers
       [PyTorch: GitHub | Nbviewer]

Fully Convolutional

  • Fully Convolutional Neural Network
       [PyTorch: GitHub | Nbviewer]

LeNet


  • LeNet-5 on MNIST
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-lenet5-mnist.ipynb

  • LeNet-5 on CIFAR-10
       [PyTorch: GitHub | Nbviewer]

  • LeNet-5 on QuickDraw
       [PyTorch: GitHub | Nbviewer]

AlexNet

  • AlexNet on CIFAR-10
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-alexnet-cifar10.ipynb

VGG


  • Convolutional Neural Network VGG-16
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/cnn/cnn-vgg16.ipynb
       [PyTorch: GitHub | Nbviewer]

  • VGG-16 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Neural Network VGG-19
       [PyTorch: GitHub | Nbviewer]

DenseNet

  • DenseNet-121 Digit Classifier Trained on MNIST
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-densenet121-mnist.ipynb

  • DenseNet-121 Image Classifier Trained on CIFAR-10
       [PyTorch: GitHub | Nbviewer]

ResNet

  • ResNet and Residual Blocks
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/resnet-ex-1.ipynb

  • ResNet-18 Digit Classifier Trained on MNIST
       [PyTorch: GitHub | Nbviewer]

  • ResNet-18 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • ResNet-34 Digit Classifier Trained on MNIST
       [PyTorch: GitHub | Nbviewer]

  • ResNet-34 Object Classifier Trained on QuickDraw
       [PyTorch: GitHub | Nbviewer]

  • ResNet-34 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • ResNet-50 Digit Classifier Trained on MNIST
       [PyTorch: GitHub | Nbviewer]

  • ResNet-50 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • ResNet-101 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • ResNet-101 Trained on CIFAR-10
       [PyTorch: GitHub | Nbviewer]

  • ResNet-152 Gender Classifier Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

Network in Network


  • Network in Network CIFAR-10 Classifier
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/nin-cifar10.ipynb


归一化层 Normalization Layers

  • BatchNorm before and after Activation for Network-in-Network CIFAR-10 Classifier
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/nin-cifar10_batchnorm.ipynb

  • Filter Response Normalization for Network-in-Network CIFAR-10 Classifier
       [PyTorch: GitHub | Nbviewer]

度量学习 Metric Learning

  • Siamese Network with Multilayer Perceptrons
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/metric/siamese-1.ipynb

自编码器 Autoencoders

全连接自编码器 Fully-connected Autoencoders

  • Autoencoder (MNIST)
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/autoencoder/ae-basic.ipynb
       [PyTorch: GitHub | Nbviewer]

  • Autoencoder (MNIST) + Scikit-Learn Random Forest Classifier
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

Convolutional Autoencoders

  • Convolutional Autoencoder with Deconvolutions / Transposed Convolutions
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Autoencoder with Deconvolutions and Continuous Jaccard Distance
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Autoencoder with Deconvolutions (without pooling operations)
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Autoencoder with Nearest-neighbor Interpolation
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Autoencoder with Nearest-neighbor Interpolation -- Trained on CelebA
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Autoencoder with Nearest-neighbor Interpolation -- Trained on Quickdraw
       [PyTorch: GitHub | Nbviewer]

Variational Autoencoders

  • Variational Autoencoder
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Variational Autoencoder
       [PyTorch: GitHub | Nbviewer]

Conditional Variational Autoencoders

  • Conditional Variational Autoencoder (with labels in reconstruction loss)
       [PyTorch: GitHub | Nbviewer]

  • Conditional Variational Autoencoder (without labels in reconstruction loss)
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Conditional Variational Autoencoder (with labels in reconstruction loss)
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Conditional Variational Autoencoder (without labels in reconstruction loss)
       [PyTorch: GitHub | Nbviewer]

生成式对抗网络 Generative Adversarial Networks (GANs)

  • Fully Connected GAN on MNIST
       [TensorFlow 1: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/gan/gan.ipynb
       [PyTorch: GitHub | Nbviewer]

  • Fully Connected Wasserstein GAN on MNIST
       [PyTorch: GitHub | Nbviewer]

  • Convolutional GAN on MNIST
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • Convolutional GAN on MNIST with Label Smoothing
       [TensorFlow 1: GitHub | Nbviewer]
       [PyTorch: GitHub | Nbviewer]

  • Convolutional Wasserstein GAN on MNIST
       [PyTorch: GitHub | Nbviewer]

图神经网络 Graph Neural Networks (GNNs)

  • Most Basic Graph Neural Network with Gaussian Filter on MNIST
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/gnn/gnn-basic-1.ipynb

  • Basic Graph Neural Network with Edge Prediction on MNIST
       [PyTorch: GitHub | Nbviewer]

  • Basic Graph Neural Network with Spectral Graph Convolution on MNIST
       [PyTorch: GitHub | Nbviewer]

循环神经网络 Recurrent Neural Networks (RNNs)

Many-to-one: Sentiment Analysis / Classification

  • A simple single-layer RNN (IMDB)
       [PyTorch: GitHub | Nbviewer]

    https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_simple_imdb.ipynb

  • A simple single-layer RNN with packed sequences to ignore padding characters (IMDB)
       [PyTorch: GitHub | Nbviewer]

  • RNN with LSTM cells (IMDB)
       [PyTorch: GitHub | Nbviewer]

  • RNN with LSTM cells (IMDB) and pre-trained GloVe word vectors
       [PyTorch: GitHub | Nbviewer]

  • RNN with LSTM cells and Own Dataset in CSV Format (IMDB)
       [PyTorch: GitHub | Nbviewer]

  • RNN with GRU cells (IMDB)
       [PyTorch: GitHub | Nbviewer]

  • Multilayer bi-directional RNN (IMDB)
       [PyTorch: GitHub | Nbviewer]

  • Bidirectional Multi-layer RNN with LSTM with Own Dataset in CSV Format (AG News)
       [PyTorch: GitHub | Nbviewer]

  • Bidirectional Multi-layer RNN with LSTM with Own Dataset in CSV Format (Yelp Review Polarity)
       [PyTorch: GitHub | Nbviewer]

  • Bidirectional Multi-layer RNN with LSTM with Own Dataset in CSV Format (Amazon Review Polarity)
       [PyTorch: GitHub | Nbviewer]

Many-to-Many / Sequence-to-Sequence

  • A simple character RNN to generate new text (Charles Dickens)
       [PyTorch: GitHub | Nbviewer]

Ordinal Regression

  • Ordinal Regression CNN -- CORAL w. ResNet34 on AFAD-Lite
       [PyTorch: GitHub | Nbviewer]

  • Ordinal Regression CNN -- Niu et al. 2016 w. ResNet34 on AFAD-Lite
       [PyTorch: GitHub | Nbviewer]

  • Ordinal Regression CNN -- Beckham and Pal 2016 w. ResNet34 on AFAD-Lite
       [PyTorch: GitHub | Nbviewer]

Tips and Tricks

  • Cyclical Learning Rate
       [PyTorch: GitHub | Nbviewer]

  • Annealing with Increasing the Batch Size (w. CIFAR-10 & AlexNet)
       [PyTorch: GitHub | Nbviewer]

  • Gradient Clipping (w. MLP on MNIST)
       [PyTorch: GitHub | Nbviewer]

 迁移学习 Transfer Learning

  • Transfer Learning Example (VGG16 pre-trained on ImageNet for Cifar-10)

   [PyTorch: GitHub | Nbviewer

https://nbviewer.jupyter.org/github/rasbt/deeplearning-models/blob/master/pytorch_ipynb/transfer/transferlearning-vgg16-cifar10-1.ipynb

PyTorch Workflows and Mechanics

Custom Datasets

  • Custom Data Loader Example for PNG Files
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- CSV files converted to HDF5
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- Face Images from CelebA
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- Drawings from Quickdraw
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- Drawings from the Street View House Number (SVHN) Dataset
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- Asian Face Dataset (AFAD)
       [PyTorch: GitHub | Nbviewer]

  • Using PyTorch Dataset Loading Utilities for Custom Datasets -- Dating Historical Color Images
       [PyTorch: GitHub | Nbviewer]

Training and Preprocessing

  • Generating Validation Set Splits
    [PyTorch]: GitHub | Nbviewer]

  • Dataloading with Pinned Memory
       [PyTorch: GitHub | Nbviewer]

  • Standardizing Images
       [PyTorch: GitHub | Nbviewer]

  • Image Transformation Examples
       [PyTorch: GitHub | Nbviewer]

  • Char-RNN with Own Text File
       [PyTorch: GitHub | Nbviewer]

  • Sentiment Classification RNN with Own CSV File
       [PyTorch: GitHub | Nbviewer]

Parallel Computing

  • Using Multiple GPUs with DataParallel -- VGG-16 Gender Classifier on CelebA
       [PyTorch: GitHub | Nbviewer]

Other

  • Sequential API and hooks
       [PyTorch: GitHub | Nbviewer]

  • Weight Sharing Within a Layer
       [PyTorch: GitHub | Nbviewer]

  • Plotting Live Training Performance in Jupyter Notebooks with just Matplotlib
       [PyTorch: GitHub | Nbviewer]

Autograd

  • Getting Gradients of an Intermediate Variable in PyTorch
       [PyTorch: GitHub | Nbviewer]

TensorFlow Workflows and Mechanics

Custom Datasets

  • Chunking an Image Dataset for Minibatch Training using NumPy NPZ Archives
       [TensorFlow 1: GitHub | Nbviewer]

  • Storing an Image Dataset for Minibatch Training using HDF5
       [TensorFlow 1: GitHub | Nbviewer]

  • Using Input Pipelines to Read Data from TFRecords Files
       [TensorFlow 1: GitHub | Nbviewer]

  • Using Queue Runners to Feed Images Directly from Disk
       [TensorFlow 1: GitHub | Nbviewer]

  • Using TensorFlow's Dataset API
       [TensorFlow 1: GitHub | Nbviewer]

Training and Preprocessing

  • Saving and Loading Trained Models -- from TensorFlow Checkpoint Files and NumPy NPZ Archives
       [TensorFlow 1: GitHub | Nbviewer]



便捷查看下载,请关注专知公众号(点击上方蓝色专知关注)

  • 后台回复“DL100” 就可以获取深度学习100+经典模型实现专知资源链接索引


专 · 知


专知,专业可信的人工智能知识分发,让认知协作更快更好!欢迎注册登录专知www.zhuanzhi.ai,获取5000+AI主题干货知识资料!
欢迎微信扫一扫加入专知人工智能知识星球群,获取最新AI专业干货知识教程视频资料和与专家交流咨询

点击“阅读原文”,了解使用专知,查看5000+AI主题知识资料

登录查看更多
32

相关内容

【经典书】机器学习:贝叶斯和优化方法,1075页pdf
专知会员服务
404+阅读 · 2020年6月8日
专知会员服务
139+阅读 · 2020年5月19日
《深度学习》圣经花书的数学推导、原理与Python代码实现
一网打尽!100+深度学习模型TensorFlow与Pytorch代码实现集合
《动手学深度学习》(Dive into Deep Learning)PyTorch实现
专知会员服务
119+阅读 · 2019年12月31日
【书籍】深度学习框架:PyTorch入门与实践(附代码)
专知会员服务
163+阅读 · 2019年10月28日
注意力机制模型最新综述
专知会员服务
266+阅读 · 2019年10月20日
Yann LeCun都推荐的深度学习资料合集!
InfoQ
14+阅读 · 2019年7月7日
机器学习的Pytorch实现资源集合
专知
11+阅读 · 2018年9月1日
TensorFlow实现深度学习算法的教程汇集:代码+笔记
数据挖掘入门与实战
8+阅读 · 2017年12月10日
推荐|深度学习PyTorch的教程代码
全球人工智能
10+阅读 · 2017年10月8日
推荐|TensorFlow/PyTorch/Sklearn实现的五十种机器学习模型
全球人工智能
24+阅读 · 2017年7月14日
Arxiv
6+阅读 · 2020年4月14日
Arxiv
8+阅读 · 2019年3月21日
Symbolic Priors for RNN-based Semantic Parsing
Arxiv
3+阅读 · 2018年9月20日
Arxiv
7+阅读 · 2018年1月31日
VIP会员
相关VIP内容
【经典书】机器学习:贝叶斯和优化方法,1075页pdf
专知会员服务
404+阅读 · 2020年6月8日
专知会员服务
139+阅读 · 2020年5月19日
《深度学习》圣经花书的数学推导、原理与Python代码实现
一网打尽!100+深度学习模型TensorFlow与Pytorch代码实现集合
《动手学深度学习》(Dive into Deep Learning)PyTorch实现
专知会员服务
119+阅读 · 2019年12月31日
【书籍】深度学习框架:PyTorch入门与实践(附代码)
专知会员服务
163+阅读 · 2019年10月28日
注意力机制模型最新综述
专知会员服务
266+阅读 · 2019年10月20日
相关资讯
Yann LeCun都推荐的深度学习资料合集!
InfoQ
14+阅读 · 2019年7月7日
机器学习的Pytorch实现资源集合
专知
11+阅读 · 2018年9月1日
TensorFlow实现深度学习算法的教程汇集:代码+笔记
数据挖掘入门与实战
8+阅读 · 2017年12月10日
推荐|深度学习PyTorch的教程代码
全球人工智能
10+阅读 · 2017年10月8日
推荐|TensorFlow/PyTorch/Sklearn实现的五十种机器学习模型
全球人工智能
24+阅读 · 2017年7月14日
Top
微信扫码咨询专知VIP会员