autoencoder

Convert Functional Model to Sequential Keras

梦想与她 提交于 2020-05-09 10:50:09
问题 I have an autoencoder from which I want to save the model, specifically of the encoder part (or weights, not exactly sure what I need) and then load that into a CNN. My goal for this is to use the autoencoder to learn features of items I want to classify, and then use those weights to start the CNN. I have tried just loading the weights, but they won't load since the two networks are different sizes. I though just importing the whole network would work, but one is sequential and the other is

Convert Functional Model to Sequential Keras

时光怂恿深爱的人放手 提交于 2020-05-09 10:49:09
问题 I have an autoencoder from which I want to save the model, specifically of the encoder part (or weights, not exactly sure what I need) and then load that into a CNN. My goal for this is to use the autoencoder to learn features of items I want to classify, and then use those weights to start the CNN. I have tried just loading the weights, but they won't load since the two networks are different sizes. I though just importing the whole network would work, but one is sequential and the other is

How to resolve runtime error due to size mismatch in PyTorch?

故事扮演 提交于 2020-02-26 20:49:09
问题 I am trying to implement a simple autoencoder using PyTorch . My dataset consists of 256 x 256 x 3 images. I have built a torch.utils.data.dataloader.DataLoader object which has the image stored as tensor. When I run the autoencoder, I get a runtime error: size mismatch, m1: [76800 x 256], m2: [784 x 128] at /Users/soumith/minicondabuild3/conda-bld/pytorch_1518371252923/work/torch/lib/TH/generic/THTensorMath.c:1434 These are my hyperparameters: batch_size=100, learning_rate = 1e-3, num_epochs

Extract features from 2 auto-encoders and feed them into an MLP

岁酱吖の 提交于 2020-01-25 07:34:06
问题 I understand that the features extracted from an auto-encoder can be fed into an mlp for classification or regression purpose. This is something that I did earlier. But what if I have 2 auto-encoders? Can I extract the features from the bottleneck layers of 2 auto-encoders and feed them into an mlp which performs classification based on these features? If yes, then how? I am not sure how to concatenate these two feature sets. I tried with numpy.hstack() which gives me 'unhashable slice' error

Keras - Autoencoder for Text Analysis

帅比萌擦擦* 提交于 2020-01-21 05:40:27
问题 So I'm trying to create an autoencoder that will take text reviews and find a lower dimensional representation. I'm using keras and I want my loss function to compare the output of the AE to the output of the embedding layer. Unfortunately, it gives me the following error. I'm pretty sure the problem is with my loss function but I can't seem to resolve the issue. Autoencoder print X_train.shape input_i = Input(shape=(200,)) embedding = Embedding(input_dim=weights.shape[0],output_dim=weights

ValueError: Input 0 is incompatible with layer conv_1: expected ndim=3, found ndim=4

二次信任 提交于 2020-01-14 09:42:24
问题 I am trying to make a variational auto encoder to learn to encode DNA sequences, but am getting an unexpected error. My data is an array of one-hot arrays. The issue I'm getting is a Value Error. It's telling me that I have a four dimensional input, when my input is clearly three-dimensional (100, 4008, 4). In fact, when I print out the seq layer, it says that it's shape is (?, 100, 4008, 4). When I take out a dimension, it then gives me an error for being two dimensional. Any help will be

Convolutional encoder error - 'RuntimeError: input and target shapes do not match'

浪尽此生 提交于 2020-01-14 03:21:09
问题 In below code three images are created, saved and a convolutional auto-encoder attempts to encode them to a lower dimensional representation. %reset -f import torch.utils.data as data_utils import warnings warnings.filterwarnings('ignore') import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib import pyplot as plt from sklearn import metrics import datetime from sklearn.preprocessing import MultiLabelBinarizer import seaborn as sns sns.set_style("darkgrid")

AutoEncoder介绍

落花浮王杯 提交于 2020-01-12 10:33:07
什么是自动编码器 自动编码器最开始作为一种数据压缩的方法,特点: 1)跟数据相关程度高 2)压缩数据是有损的 应用: 1)数据去噪 2)可视化降维 3)生成数据 4)数据压缩 自动编码器的结构 通常我们使用神经网络模型作为编码器和解码器。 PyTorch实现自动编码器 多层感知器 class autoencoder ( nn . Module ) : def __init__ ( self ) : super ( autoencoder , self ) . __init__ ( ) self . encoder = nn . Sequential ( nn . Linear ( 28 * 28 , 128 ) , nn . ReLU ( True ) , nn . Linear ( 128 , 64 ) , nn . ReLU ( True ) , nn . Linear ( 64 , 12 ) , nn . ReLU ( True ) , nn . Linear ( 12 , 3 ) ) self . decoder = nn . Sequential ( nn . Linear ( 3 , 12 ) , nn . ReLU ( True ) , nn . Linear ( 12 , 64 ) , nn . ReLU ( True ) , nn . Linear ( 64 ,

LSTM/GRU autoencoder convergency

我们两清 提交于 2020-01-11 07:57:08
问题 Goal I have a strange situation trying to create an efficient autoencoder over my time series dataset: X_train (200, 23, 178) X_val (100, 23, 178) X_test (100, 23, 178) Current situation With a simple autoencoder I have better results rather than my simple LSTM AE over a dataset of time series. I have some concerns about my utilization of the Repeat Vector wrapper layer, which as far as I understood, is supposed to repeat a number of times like the sequence length the last state of the LSTM

Dimension mismatch in Keras during model.fit

萝らか妹 提交于 2020-01-10 04:38:33
问题 I put together a VAE using Dense Neural Networks in Keras. During model.fit I get a dimension mismatch, but not sure what is throwing the code off. Below is what my code looks like from keras.layers import Lambda, Input, Dense from keras.models import Model from keras.datasets import mnist from keras.losses import mse, binary_crossentropy from keras.utils import plot_model from keras import backend as K import keras import numpy as np import matplotlib.pyplot as plt import argparse import os