autoencoder

how to see tensor value of a layer output in keras

点点圈 提交于 2020-12-13 09:27:21
问题 I have a Seq2Seq model. I am interested to print out the matrix value of the output of the encoder per iteration. So for example as the dimension of the matrix in the encoder is (?,20) and the epoch =5 and in each epoch, there are 10 iteration, I would like to see 10 matrix of the dimension (?,20) per epoch . I have gone to several links as here but it still does not print out the value matrix. With this code as mentioned in the aboved link: import keras.backend as K k_value = K.print_tensor

How to use TimeDistributed layer for predicting sequences of dynamic length? PYTHON 3

孤人 提交于 2020-08-26 09:01:49
问题 So I am trying to build an LSTM based autoencoder, which I want to use for the time series data. These are spitted up to sequences of different lengths. Input to the model has thus shape [None, None, n_features], where the first None stands for number of samples and the second for time_steps of the sequence. The sequences are processed by LSTM with argument return_sequences = False, coded dimension is then recreated by function RepeatVector and ran through LSTM again. In the end I would like

TensorBoard: How to write images to get a steps slider?

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-05 05:39:21
问题 I'm using keras in my ML project with the TensorBoard callback. I have an image autoencoder and I want to visualize its progress in reconstructing some images. So I sub-classed the TensorBoard class as such: class Monitor(TensorBoard): def on_train_begin(self, logs=None): super().on_train_begin(logs) def on_epoch_begin(self, epoch, logs=None): # 1. Get the reconstructed images reconstructions = Autoencoder.predict(validation[0]) # 2. Generate a summary summary = tf.summary.image(

Pytorch Convolutional Autoencoders

烈酒焚心 提交于 2020-07-09 02:56:27
问题 How one construct decoder part of convolutional autoencoder? Suppose I have this (input -> conv2d -> maxpool2d -> maxunpool2d -> convTranspose2d -> output) : # CIFAR images shape = 3 x 32 x 32 class ConvDAE(nn.Module): def __init__(self): super().__init__() # input: batch x 3 x 32 x 32 -> output: batch x 16 x 16 x 16 self.encoder = nn.Sequential( nn.Conv2d(3, 16, 3, stride=1, padding=1), # batch x 16 x 32 x 32 nn.ReLU(), nn.BatchNorm2d(16), nn.MaxPool2d(2, stride=2) # batch x 16 x 16 x 16 ) #