新智元报道
来源:Github
编辑整理:元子
本文搜集整理了Jupyter Notebook中TensorFlow和PyTorch的各种深度学习架构,模型和技巧,内容非常丰富,适用于Python 3.7,适合当做工具书。
大家可以将内容按照需要进行分割,打印出来,或者做成电子书等,随时查阅。
感知器
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/perceptron.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/perceptron.ipynb
逻辑回归
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/logistic-regression.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/logistic-regression.ipynb
Softmax Regression (Multinomial Logistic Regression)
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/basic-ml/softmax-regression.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/basic-ml/softmax-regression.ipynb
多层感知器
多层感知器
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mlp/mlp-basic.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-basic.ipynb
具有Dropout多层感知器
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mlp/mlp-dropout.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-dropout.ipynb
具有批量归一化的多层感知器
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mlp/mlp-batchnorm.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-batchnorm.ipynb
具有反向传播的多层感知器
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mlp/mlp-lowlevel.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-fromscratch__sigmoid-mse.ipynb
基础
CNN
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/cnn/convnet.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-basic.ipynb
具有He初始化的CNN
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-he-init.ipynb
概念
用等效卷积层代替完全连接
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/fc-to-conv.ipynb
全卷积
全卷积神经网络
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-allconv.ipynb
AlexNet
AlexNet on CIFAR-10
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-alexnet-cifar10.ipynb
VGG
CNN VGG-16
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/cnn/cnn-vgg16.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-vgg16.ipynb
VGG-16 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-vgg16-celeba.ipynb
CNN VGG-19
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-vgg19.ipynb
ResNet
ResNet and Residual Blocks
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/resnet-ex-1.ipynb
ResNet-18 Digit Classifier Trained on MNIST
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet18-mnist.ipynb
ResNet-18 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet18-celeba-dataparallel.ipynb
ResNet-34 Digit Classifier Trained on MNIST
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet34-mnist.ipynb
ResNet-34 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet34-celeba-dataparallel.ipynb
ResNet-50 Digit Classifier Trained on MNIST
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet50-mnist.ipynb
ResNet-50 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet50-celeba-dataparallel.ipynb
ResNet-101 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet101-celeba.ipynb
ResNet-152 Gender Classifier Trained on CelebA
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet152-celeba.ipynb
Network in Network
Network in Network CIFAR-10 Classifier
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/nin-cifar10.ipynb
具有多层感知器的孪生网络
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/metric/siamese-1.ipynb
全连接自动编码机
自动编码机
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/autoencoder/autoencoder.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-basic.ipynb
具有解卷积/转置卷积的卷积自动编码机
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/autoencoder/ae-deconv.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-deconv.ipynb
具有解卷积的卷积自动编码机(无池化操作)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/aer-deconv-nopool.ipynb
具有最近邻插值的卷积自动编码机
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/autoencoder/autoencoder-conv-nneighbor.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-conv-nneighbor.ipynb
具有最近邻插值的卷积自动编码机 - 在CelebA上进行训练
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-conv-nneighbor-celeba.ipynb
具有最近邻插值的卷积自动编码机 - 在Quickdraw上训练
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-conv-nneighbor-quickdraw-1.ipynb
变分自动编码机
变分自动编码机
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-var.ipynb
卷积变分自动编码机
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-conv-var.ipynb
条件变分自动编码机
条件变分自动编码机(重建丢失中带标签)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-cvae.ipynb
条件变分自动编码机(重建损失中没有标签)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-cvae_no-out-concat.ipynb
卷积条件变分自动编码机(重建丢失中带标签)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-cnn-cvae.ipynb
卷积条件变分自动编码机(重建损失中没有标签)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/autoencoder/ae-cnn-cvae_no-out-concat.ipynb
MNIST上完全连接的GAN
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/gan/gan.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/gan/gan.ipynb
MNIST上的卷积GAN
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/gan/gan-conv.ipynb
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/gan/gan-conv.ipynb
具有标签平滑的MNIST上的卷积GAN
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/gan/gan-conv-smoothing.ipynb
Many-to-one: Sentiment Analysis / Classification
A simple single-layer RNN (IMDB)
PyTorch:
https://github.com/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:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_simple_packed_imdb.ipynb
RNN with LSTM cells (IMDB)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_lstm_packed_imdb.ipynb
RNN with LSTM cells and Own Dataset in CSV Format (IMDB)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_lstm_packed_own_csv_imdb.ipynb
RNN with GRU cells (IMDB)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_gru_packed_imdb.ipynb
Multilayer bi-directional RNN (IMDB)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_gru_packed_imdb.ipynb
Many-to-Many / Sequence-to-Sequence
A simple character RNN to generate new text (Charles Dickens)
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/char_rnn-charlesdickens.ipynb
Ordinal Regression CNN -CORAL w. ResNet34 on AFAD-Lite
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/ordinal/ordinal-cnn-coral-afadlite.ipynb
Ordinal Regression CNN -Niu et al. 2016 w. ResNet34 on AFAD-Lite
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/ordinal/ordinal-cnn-niu-afadlite.ipynb
Ordinal Regression CNN -Beckham and Pal 2016 w. ResNet34 on AFAD-Lite
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/ordinal/ordinal-cnn-niu-afadlite.ipynb
Cyclical Learning Rate
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/tricks/cyclical-learning-rate.ipynb
自定义数据集
使用PyTorch数据集加载实用程序用于自定义数据集-CSV文件转换为HDF5
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/custom-data-loader-csv.ipynb
使用PyTorch数据集加载自定义数据集的实用程序 - 来自CelebA的图像
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/custom-data-loader-celeba.ipynb
使用PyTorch数据集加载自定义数据集的实用程序 - 从Quickdraw中提取
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/custom-data-loader-quickdraw.ipynb
使用PyTorch数据集加载实用程序用于自定义数据集 - 从街景房号(SVHN)数据集中绘制
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/custom-data-loader-svhn.ipynb
训练和预处理
带固定内存的数据加载
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-resnet34-cifar10-pinmem.ipynb
标准化图像
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-standardized.ipynb
图像转换示例
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/torchvision-transform-examples.ipynb
Char-RNN with Own Text File
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/char_rnn-charlesdickens.ipynb
Sentiment Classification RNN with Own CSV File
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/rnn/rnn_lstm_packed_own_csv_imdb.ipynb
并行计算
在CelebA上使用具有DataParallel -VGG-16性别分类器的多个GPU
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/cnn/cnn-vgg16-celeba-data-parallel.ipynb
其它
Sequential API and hooks
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/mlp-sequential.ipynb
图层内的权重共享
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/cnn-weight-sharing.ipynb
仅使用Matplotlib在Jupyter Notebook中绘制实时训练性能
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mlp/plot-jupyter-matplotlib.ipynb
Autograd
在PyTorch中获取中间变量的渐变
PyTorch:
https://github.com/rasbt/deeplearning-models/blob/master/pytorch_ipynb/mechanics/manual-gradients.ipynb
自定义数据集
使用NumPy NPZ Archives为Minibatch训练添加图像数据集
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/image-data-chunking-npz.ipynb
使用HDF5存储用于Minibatch培训的图像数据集
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/image-data-chunking-hdf5.ipynb
使用输入Pipeline从TFRecords文件中读取数据
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/tfrecords.ipynb
使用队列运行器直接从磁盘提供图像
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/file-queues.ipynb
使用TensorFlow的Dataset API
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/dataset-api.ipynb
训练和预处理
保存和加载训练模型 - 来自TensorFlow Checkpoint文件和NumPy NPZ Archives
TensorFlow 1:
https://github.com/rasbt/deeplearning-models/blob/master/tensorflow1_ipynb/mechanics/saving-and-reloading-models.ipynb
参考链接:
https://github.com/rasbt/deeplearning-models