简体   繁体   中英

i-RevNet on keras on MNIST dataset

I want to implement i-RevNet on MNIST dataset on keras and generate the original 28*28 input images from the output of i-RevNet, but i don't have a clue. Online resources I can find are all based on tensorflow.

important is this paper https://arxiv.org/pdf/1802.07088.pdf - i-REVNET: DEEP INVERTIBLE NETWORKS and this git https://github.com/jhjacobsen/pytorch-i-revnet

when reading the above paper critical components in i-RevNets are homeomorphic layers , on the link between topology and neural nets cf http://colah.github.io/posts/2014-03-NN-Manifolds-Topology/ - Neural Networks, Manifolds, and Topology ( search for 'homeomorphic' )

in https://github.com/jhjacobsen/pytorch-i-revnet homeomorphic layers are implemented in class irevnet_block(nn.Module) , note that there are NO operations that discard information like maxpooling, averaging, ... ( with exception of the output layer ), only batch normalization ( https://towardsdatascience.com/batch-normalization-in-neural-networks-1ac91516821c ) is applied, the ReLUs are also locally strictly linear.

in Where do I call the BatchNormalization function in Keras? is how to implement this in keras, simply stack the layers into a homeomorphic layer:

homeomorphic layer -> NO POOLING, ... LAYERS
model.add(Dense(64, init='uniform'))
model.add(Activation('relu'))
model.add(BatchNormalization())

the rest of the code in https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/iRevNet.py like ie def inverse(self, x) or def forward(self, x) can be reproduced using the keras functions in https://keras.io/layers/merge/ . Cf https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/model_utils.py on the merge and split functions, they use torch.cat and torch.split whichs keras equivalents are in https://keras.io/layers/merge/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM