Error in dlfeval for Variational Autoencoders

4 次查看(过去 30 天)
I am trying to implement the VAE on my data. I found the following link:
In this example the number of training images from the MNIST dataset is 60,000 images for training and 10,000 images for testing, the imageSize = [28 28 1];
My dataset is 8522 images for training, and 2135 images for testing, the imageSize = [227 227 3];
My 1st question is, does this code work only for gray scale images? if yes, is there a way to use VAE for RGB images?
2nd question is: How can I solve this error from implementing [infGrad, genGrad] = dlfeval(@modelGradients, encoderNet, decoderNet, XBatch); do I need to change the encoderNet, or decoderNet for my data?
error description:
Error using -
Matrix dimensions must agree.
Error in deep.internal.recording.operations.MinusBroadcastOp/forward (line 32)
x = x - y;
Error in - (line 39)
xdata = xdata - ydata;
Error in ELBOloss (line 2)
squares = 0.5*(xPred-x).^2;
Error in modelGradients (line 4)
loss = ELBOloss(x, xPred, zMean, zLogvar);
Error in deep.internal.dlfeval (line 18)
[varargout{1:nout}] = fun(x{:});
Error in dlfeval (line 40)
[varargout{1:nout}] = deep.internal.dlfeval(fun,varargin{:});
Error in Test_VAE_mydata (line 67)
[infGrad, genGrad] = dlfeval(...
  1 个评论
Nick
Nick 2020-7-23
Have you adjusted the image pre-processor and the layers to match your new data format ?

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by