ImageDataStore read issue -- works sometimes, sometimes not
9 次查看(过去 30 天)
显示 更早的评论
I'm getting the below error when trying to read from an image datastore, manipulate, and write. The strange part is that I can read the file using imread perfectly fine. I'm literally copying the filename from the error message and pasting it into an imread command and it works. Any idea how I can troubleshoot this?
Error using matlab.io.datastore.ImageDatastore/read (line 77)
Unable to read file: <redacted filename>
Error in matlab.io.datastore.FileWritable/writeSerial (line 14)
[data, readInfo] = read(dsCopy);
Error in matlab.io.datastore.FileWritable/writeParallel (line 45)
parfor (ii = 1 : size(files,1), M)
Error in matlab.io.datastore.FileWritable/writeall (line 272)
writeParallel(ds, location, files, nvStruct);
Error in augment_images (line 101)
writeall(subds, [options.Filenames.OutputDir options.Mag],
'FilenameSuffix',suffix,
'OutputFormat',options.Filenames.OutputFormat,
'UseParallel',true);
Caused by:
Error using
matlab.io.datastore.exceptions.decorateCustomFunctionError>generateReadFcnError
(line 103)
Error using ReadFcn @readDatastoreImage for file:
<redacted filename>
Error using imread>get_full_filename (line 564)
Cannot open file "<redacted filename>" for reading.
You might not have read permission.
Error in imread (line 374)
fullname = get_full_filename(filename);
Error in readDatastoreImage (line 12)
data = imread(filename);
0 个评论
回答(2 个)
Mahesh Taparia
2021-2-4
Hi
It seems either the folder path is inappropriate or the files are not in the supported image format. Correct the folder path of the files, it will work.
2 个评论
Mahesh Taparia
2021-2-4
Hi
Can you upload a sample image from your dataset?
Also let me know, if the below code is working your not.
imds = imageDatastore(fullfile(matlabroot,'toolbox','matlab'),...
'IncludeSubfolders',true,'FileExtensions','.tif','LabelSource','foldernames')
Steven Lord
2021-2-4
If you try running imread inside a parfor loop rather than at the MATLAB prompt, does it throw an error? I'm wondering if the parallel pool is running the workers on a cluster as a different user that does not have the necessary permissions to access the data files.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Datastore 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!