是否有使用 MxNet 构建卷积自动编码器的玩具示例?
Is there any toy example of building convolutional autoencoders using MxNet?
我正在寻找使用 MxNet 的卷积自动编码器的实现。但是基于Fully Connected Networks的autoencoder只有一个例子,就是here。在 github 中也有一个 issue 提出类似的问题,但收到的回复很少。是否有使用 MxNet 实现的卷积自动编码器的玩具示例?
mxnet 中仍然没有卷积自动编码器示例,尽管有一些 progress in research in that area. Anyway, there is a ticket for that in MxNet github, but it is still open. You are more than welcome to contribute, by, for example, migrating the code from Keras。
请在 Mxnet Gluon 中找到 Conv Autoencoder 模型的示例。代码引用自 here。在 Gluon 中以标准方式训练此模型。
from mxnet import gluon as g
class CNNAutoencoder(g.nn.HybridBlock):
def __init__(self):
super(CNNAutoencoder, self).__init__()
with self.name_scope():
self.encoder = g.nn.HybridSequential('encoder_')
with self.encoder.name_scope():
self.encoder.add(g.nn.Conv2D(16, 3, strides=3, padding=1, activation='relu'))
self.encoder.add(g.nn.MaxPool2D(2, 2))
self.encoder.add(g.nn.Conv2D(8, 3, strides=2, padding=1, activation='relu'))
self.encoder.add(g.nn.MaxPool2D(2, 1))
self.decoder = g.nn.HybridSequential('decoder_')
with self.decoder.name_scope():
self.decoder.add(g.nn.Conv2DTranspose(16, 3, strides=2, activation='relu'))
self.decoder.add(g.nn.Conv2DTranspose(8, 5, strides=3, padding=1, activation='relu'))
self.decoder.add(g.nn.Conv2DTranspose(1, 2, strides=2, padding=1, activation='tanh'))
def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
return x
model = CNNAutoencoder()
model.hybridize()
我正在寻找使用 MxNet 的卷积自动编码器的实现。但是基于Fully Connected Networks的autoencoder只有一个例子,就是here。在 github 中也有一个 issue 提出类似的问题,但收到的回复很少。是否有使用 MxNet 实现的卷积自动编码器的玩具示例?
mxnet 中仍然没有卷积自动编码器示例,尽管有一些 progress in research in that area. Anyway, there is a ticket for that in MxNet github, but it is still open. You are more than welcome to contribute, by, for example, migrating the code from Keras。
请在 Mxnet Gluon 中找到 Conv Autoencoder 模型的示例。代码引用自 here。在 Gluon 中以标准方式训练此模型。
from mxnet import gluon as g
class CNNAutoencoder(g.nn.HybridBlock):
def __init__(self):
super(CNNAutoencoder, self).__init__()
with self.name_scope():
self.encoder = g.nn.HybridSequential('encoder_')
with self.encoder.name_scope():
self.encoder.add(g.nn.Conv2D(16, 3, strides=3, padding=1, activation='relu'))
self.encoder.add(g.nn.MaxPool2D(2, 2))
self.encoder.add(g.nn.Conv2D(8, 3, strides=2, padding=1, activation='relu'))
self.encoder.add(g.nn.MaxPool2D(2, 1))
self.decoder = g.nn.HybridSequential('decoder_')
with self.decoder.name_scope():
self.decoder.add(g.nn.Conv2DTranspose(16, 3, strides=2, activation='relu'))
self.decoder.add(g.nn.Conv2DTranspose(8, 5, strides=3, padding=1, activation='relu'))
self.decoder.add(g.nn.Conv2DTranspose(1, 2, strides=2, padding=1, activation='tanh'))
def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
return x
model = CNNAutoencoder()
model.hybridize()