You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Error in minibatchqueue (line 290) numVariables = numel(getPreviewFromDatastore(originalDatastore));
6 views (last 30 days)
Show older comments
Hi,
I am only trying to recreate this example: https://www.mathworks.com/help/images/unsupervised-medical-image-denoising-using-unit.html
I get this error :
------
Error in minibatchqueue (line 290)
numVariables = numel(getPreviewFromDatastore(originalDatastore));
Error in ourmodel (line 32)
mbqLDTrain = minibatchqueue(imdsLDTrain,MiniBatchSize=miniBatchSize, ...
------
Part of the code:
miniBatchSize = 1;
mbqLDTrain = minibatchqueue(imdsLDTrain,MiniBatchSize=miniBatchSize, ...
MiniBatchFormat="SSCB",DispatchInBackground=canUseGPU);
mbqHDTrain = minibatchqueue(imdsHDTrain,MiniBatchSize=miniBatchSize, ...
MiniBatchFormat="SSCB",DispatchInBackground=canUseGPU);
My matlab is R2021a version with Deep Learning Toolbox.
How do i fix this error ?
Thank You
9 Comments
Joss Knight
on 3 Apr 2022
That's not it Abu. I'm after the complete text of the error message - the red text shown in the command window that you're asking about.
Joss Knight
on 17 Apr 2022
Edited: Joss Knight
on 17 Apr 2022
If that's the case I can only assume you are using Live Script and the error message is stuck inside the live script window...or perhaps you're using Simulink? You see, every error comes with an error message (saying what the problem is) followed by the call stack (saying where the problem occurred). What you have given me is just the call stack. That makes it hard to diagnose your problem.
Let's try this: Please type the command that causes the error in the command window (not the editor), then copy-paste all the text output including the command you typed. The command that is erroring appears to be the following:
mbqLDTrain = minibatchqueue(imdsLDTrain,MiniBatchSize=miniBatchSize, ...
MiniBatchFormat="SSCB",DispatchInBackground=canUseGPU);
So type that, hit return, and then copy everything in the command window, including the above text, all the way down to the bottom, even if it doesn't fit on one screen, and paste it all here for us to look at. Thanks.
Abu Yusuf
on 18 Apr 2022
Invalid transform function defined on datastore.
The cause of the error was:
Undefined function 'augmentDataForLD2HDCT' for input arguments of type 'double'.
Error in @(x)augmentDataForLD2HDCT(x,inputSize)
Error in matlab.io.datastore.TransformedDatastore/applyTransforms (line 607)
data = ds.Transforms{ii}(data);
Error in matlab.io.datastore.TransformedDatastore/read (line 222)
[data, info] = ds.applyTransforms(data, info);
Error in matlab.io.datastore.TransformedDatastore/preview (line 292)
dataFromRead = read(copyds);
Error in getPreviewFromDatastore (line 9)
previewData = preview(inputDatastore);
Error in minibatchqueue (line 290)
numVariables = numel(getPreviewFromDatastore(originalDatastore));
Joss Knight
on 18 Apr 2022
Great! So there's your answer. When you modified this example you presumably forgot to copy over the accompanying file augmentDataForLD2HDCT.m.
Accepted Answer
Joss Knight
on 18 Apr 2022
Make sure the accompanying file augmentDataForLD2HDCT.m that comes with this example is on the path when you run your code.
9 Comments
Joss Knight
on 19 Apr 2022
"the accompanying file augmentDataForLD2HDCT.m that comes with this example"
Abu Yusuf
on 19 Apr 2022
Please, I don't know where to find it.. Can you check if it is on the example page.
Joss Knight
on 20 Apr 2022
Obviously you have to have the example open in MATLAB. I assumed you had done that otherwise how did you get the example running in the first place? You need to click on one of the big buttons at the top right of the example to open it in MATLAB. You can either open in MATLAB Online, or choose "Copy Command" and then run the openExample command in MATLAB:
openExample('images_deeplearning/UnsupervisedCTImageDenoisingUsingUNITExample')
Then you'll see the file augmentDataForLD2HDCT.m in your current folder.
Joss Knight
on 21 Apr 2022
You probably don't have the Image Processing Toolbox, which seems to be required for this example. What is the output of the ver command?
Abu Yusuf
on 21 Apr 2022
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.10.0.1602886 (R2021a)
MATLAB License Number: 968398
Operating System: Microsoft Windows 10 Professionnel Éducation Version 10.0 (Build 19043)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.10 (R2021a)
Simulink Version 10.3 (R2021a)
5G Toolbox Version 2.2 (R2021a)
Audio Toolbox Version 3.0 (R2021a)
Bioinformatics Toolbox Version 4.15.1 (R2021a)
Communications Toolbox Version 7.5 (R2021a)
Computer Vision Toolbox Version 10.0 (R2021a)
Control System Toolbox Version 10.10 (R2021a)
Curve Fitting Toolbox Version 3.5.13 (R2021a)
DSP System Toolbox Version 9.12 (R2021a)
Data Acquisition Toolbox Version 4.3 (R2021a)
Database Toolbox Version 10.1 (R2021a)
Datafeed Toolbox Version 6.0 (R2021a)
Deep Learning HDL Toolbox Version 1.1 (R2021a)
Deep Learning Toolbox Version 14.2 (R2021a)
GPU Coder Version 2.1 (R2021a)
Image Acquisition Toolbox Version 6.4 (R2021a)
Image Processing Toolbox Version 11.3 (R2021a)
Instrument Control Toolbox Version 4.4 (R2021a)
MATLAB Coder Version 5.2 (R2021a)
MATLAB Compiler Version 8.2 (R2021a)
MATLAB Compiler SDK Version 6.10 (R2021a)
MATLAB Parallel Server Version 7.4 (R2021a)
MATLAB Report Generator Version 5.10 (R2021a)
Mapping Toolbox Version 5.1 (R2021a)
Optimization Toolbox Version 9.1 (R2021a)
Parallel Computing Toolbox Version 7.4 (R2021a)
Partial Differential Equation Toolbox Version 3.6 (R2021a)
Signal Processing Toolbox Version 8.6 (R2021a)
SimBiology Version 6.1 (R2021a)
SimEvents Version 5.10 (R2021a)
Simscape Version 5.1 (R2021a)
Simscape Driveline Version 3.3 (R2021a)
Simscape Electrical Version 7.5 (R2021a)
Simscape Fluids Version 3.2 (R2021a)
Simscape Multibody Version 7.3 (R2021a)
Simulink 3D Animation Version 9.2 (R2021a)
Simulink Check Version 5.1 (R2021a)
Simulink Code Inspector Version 3.8 (R2021a)
Simulink Coder Version 9.5 (R2021a)
Simulink Compiler Version 1.2 (R2021a)
Simulink Control Design Version 5.7 (R2021a)
Simulink Coverage Version 5.2 (R2021a)
Statistics and Machine Learning Toolbox Version 12.1 (R2021a)
Symbolic Math Toolbox Version 8.7 (R2021a)
System Identification Toolbox Version 9.14 (R2021a)
Joss Knight
on 21 Apr 2022
Well, that explains it. That example didn't exist in R2021a and doesn't work with it. Either upgrade MATLAB, or look for an example in the archive documentation that will work and which you can adapt for your purposes: https://www.mathworks.com/help/releases/R2021a/deeplearning/examples.html
More Answers (0)
See Also
Categories
Find more on Model Statistics in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)