使用MxNet构建卷积自编码器的示例有吗?

我在寻找使用MxNet实现的卷积自编码器的例子。但是,我只找到一个基于全连接网络的自编码器示例,在这里。GitHub上也有类似问题的讨论,但几乎没有回应。使用MxNet实现的卷积自编码器有没有简单的示例?


回答:

请查看Mxnet Gluon中卷积自编码器模型的一个示例。代码引用自这里。以标准方式在Gluon中训练这个模型。

from mxnet import gluon as gclass 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 xmodel = CNNAutoencoder()model.hybridize()

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注