MiniBatch Error for GAN training
12 views (last 30 days)
Show older comments
When I was following the provided code GAN MATLAB, and I was executed the code in MATLABR2023a. I found that the below code is having the mini batch error. I have installed the Deep Learning Toolbox in my MATLAB. Please help me to solve it. Thanks in advance!
augimds.MiniBatchSize = miniBatchSize;
mbq = minibatchqueue(augimds, ...
MiniBatchSize=miniBatchSize, ...
PartialMiniBatch="discard", ...
MiniBatchFcn=@preprocessMiniBatch, ...
MiniBatchFormat="SSCB");
Error using minibatchqueue>iValidateMiniBatchFcn
Invalid value for 'MiniBatchFcn'. Unable to find function 'preprocessMiniBatch'.
Error in minibatchqueue>iParseInputs (line 695)
iValidateMiniBatchFcn(options.MiniBatchFcn, numVariables, options.NumOutputs);
Error in minibatchqueue (line 291)
options = iParseInputs(numVariables, varargin{:});
Error in gangan (line 83)
mbq = minibatchqueue(augimds, ...
0 Comments
Answers (1)
Sugandhi
on 14 May 2023
Hi Candy Lau,
The error message indicates that MATLAB cannot find the `preprocessMiniBatch` function, which is used as input to the `MiniBatchFcn` argument of the `minibatchqueue` function. This error can occur if the function is not defined in the current workspace or on the MATLAB path.
To resolve this error, one of the possible workaround can be to define the `preprocessMiniBatch` function in a separate file or script in the same folder or on the MATLAB path.
Once you have defined the `preprocessMiniBatch` function, save it to a separate file or script, and make sure that the file is on the MATLAB path. Then, modify the `mbq` initialization code in your script to the following:
mbq = minibatchqueue(augimds, ...
'MiniBatchSize', miniBatchSize, ...
'PartialMiniBatch', 'discard', ...
'MiniBatchFcn', @preprocessMiniBatch, ...
'MiniBatchFormat', 'SSCB');
This should properly initialize the `mbq` object with your custom `preprocessMiniBatch` function and resolve the error you are seeing.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!