【发布时间】:2019-01-15 22:26:18
【问题描述】:
我想在 keras 上的 MNIST 数据集上实现 i-RevNet,并从 i-RevNet 的输出生成原始的 28*28 输入图像,但我不知道。我能找到的网上资源都是基于tensorflow的。
【问题讨论】:
我想在 keras 上的 MNIST 数据集上实现 i-RevNet,并从 i-RevNet 的输出生成原始的 28*28 输入图像,但我不知道。我能找到的网上资源都是基于tensorflow的。
【问题讨论】:
重要的是这篇论文 https://arxiv.org/pdf/1802.07088.pdf - i-REVNET: DEEP INVERTIBLE NETWORKS 和这个 git https://github.com/jhjacobsen/pytorch-i-revnet
在阅读上述论文时,i-RevNets 中的关键组件是同胚层,关于拓扑和神经网络之间的链接 cf http://colah.github.io/posts/2014-03-NN-Manifolds-Topology/ - 神经网络、流形和拓扑 strong>(搜索“同胚”)
在https://github.com/jhjacobsen/pytorch-i-revnet 中,同胚层在class irevnet_block(nn.Module) 中实现,请注意有NO 操作会丢弃maxpooling、平均... 等信息(除了输出层的),只应用了 batch normalization (https://towardsdatascience.com/batch-normalization-in-neural-networks-1ac91516821c),ReLUs 也是局部严格线性的。
Where do I call the BatchNormalization function in Keras? 中是如何在 keras 中实现这个的,只需将层堆叠成同胚层:
homeomorphic layer -> NO POOLING, ... LAYERS
model.add(Dense(64, init='uniform'))
model.add(Activation('relu'))
model.add(BatchNormalization())
https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/iRevNet.py 中的其余代码,例如 def inverse(self, x) 或 def forward(self, x) 可以使用 https://keras.io/layers/merge/ 中的 keras 函数复制。在merge 和split 函数上参见https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/model_utils.py,它们使用torch.cat 和torch.split,这是在https://keras.io/layers/merge/ 中的keras 等效项
【讨论】: