autoencoder

I am trying to build a variational autoencoder. I am getting an error while running model.fit which I don't understand

I am trying to build a variational autoencoder. I am getting an error while running model.fit which I don't understand Question: Epoch 1/10 ————————————————————————— TypeError Traceback (most recent call last) <ipython-input-28-f82b6d9aa841> in <cell line: 2>() 1 # Train model —-> 2 model.fit(X_train, y_train, epochs=10, batch_size=16, validation_data=(X_val, y_val)) 1 frames /usr/local/lib/python3.9/dist-packages/keras/engine/training.py in tf__train_function(iterator) 13 try: 14 …

Total answers: 1

ValueError: in user code: ValueError: No gradients provided for any variable for Autoencoder Tensorflow

ValueError: in user code: ValueError: No gradients provided for any variable for Autoencoder Tensorflow Question: I have the above code and I have the below error during my fit ValueError: No gradients provided for any variable: ([‘dense_12/kernel:0’, ‘dense_12/bias:0’, ‘dense_13/kernel:0’, ‘dense_13/bias:0’],). Provided grads_and_vars is ((None, <tf.Variable ‘dense_12/kernel:0’ shape=(784, 2) dtype=float32>), (None, <tf.Variable ‘dense_12/bias:0’ shape=(2,) dtype=float32>), (None, …

Total answers: 1

The function for tensor value generates this Error: 'false_fn' must be callable

The function for tensor value generates this Error: 'false_fn' must be callable Question: I am creating a function that takes a tensor value and returns the result by applying the following formulation, There are 3 conditions so I am using @tf.functions. def Spa(x): x= tf.convert_to_tensor(float(x), dtype=tf.float32) p= tf.convert_to_tensor(float(0.05), dtype=tf.float32) p_dash=x K = p*logp_dash Ku=K.sum(Ku) Ku= …

Total answers: 2

Strange error: TypeError: forward() takes 2 positional arguments but 3 were given

Strange error: TypeError: forward() takes 2 positional arguments but 3 were given Question: I am trying to train a VAE model. However I keep getting the following error: Traceback (most recent call last): File "/Users/devcharaf/Documents/Uni/UdeM/Internship/newGNN/app/train.py", line 28, in <module> trained_model, loss = train(model, train_data, optimizer, num_epochs=1000, model_type="VAE") File "/Users/devcharaf/Documents/Uni/UdeM/Internship/newGNN/app/utils.py", line 322, in train recon_x, mean, …

Total answers: 2

I want to split into train/test my numpy array files

I want to split into train/test my numpy array files Question: I have 12000 files each in .npy format. Im doing this because my images are grayscaled. Each file is (64,64). I want to know if there is a way to split into test and train to use for an Autoencoder. (64,64) numpy image My …

Total answers: 1

Pytorch identifying batch size as number of channels in Conv2d layer

Pytorch identifying batch size as number of channels in Conv2d layer Question: I am a total newbie to neural networks using Pytorch to create a VAE model. I’ve used a bit of tensorflow before, but I have no idea what "in_channels" and "out_channels" are, as arguments to nn.Conv2d/nn.Conv1d. Disclaimers aside, currently, my model takes in …

Total answers: 3

CNN autoencoder with non square input shapes

CNN autoencoder with non square input shapes Question: I have implemented a CNN autoencoder which does not have square shape inputs. I am bit confused. Is it mandatory to have a squared shape input for autoencoders ? Each of the 2D image has a shape of 800×20. I have fed the data according to the …

Total answers: 1

Extracting hidden features from Autoencoders using Pytorch

Extracting hidden features from Autoencoders using Pytorch Question: Following the tutorials in this post, I am trying to train an autoencoder and extract the features from its hidden layer. So here are my questions: In the autoencoder class, there is a "forward" function. However, I cannot see anywhere in the code that this function is …

Total answers: 2

Define custom loss (perceptual loss) in CNN autoencoder with pre-train vgg19 tensorflow,Keras

Define custom loss (perceptual loss) in CNN autoencoder with pre-train vgg19 tensorflow,Keras Question: i want to define perceptual_loss in autoencoder that build in keras. my autoencoder is look like this : Encoder: input_encoder = Input((32,32,3),name = ‘encoder_input’) encoder = Conv2D(16,(3,3),activation = ‘relu’,name = ‘encoder_layer1’)(input_encoder) encoder = Flatten(name = ‘encoder_layer2’)(encoder) latent_encoding = Dense(128 , activation = …

Total answers: 2

Convolutional Autoencoder for classification problem

Convolutional Autoencoder for classification problem Question: I am following with Datacamp’s tutorial on using convolutional autoencoders for classification here. I understand in the tutorial that we only need the autoencoder’s head (i.e. the encoder part) stacked to a fully-connected layer to do the classification. After stacking, the resulting network (convolutional-autoencoder) is trained twice. The first …

Total answers: 2