ImageDataStore read issue -- works sometimes, sometimes not

20 visualizaciones (últimos 30 días)
Mark Zarella
Mark Zarella el 7 de En. de 2021
Respondida: Steven Lord el 4 de Feb. de 2021
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);

Respuestas (2)

Mahesh Taparia
Mahesh Taparia el 4 de Feb. de 2021
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 comentarios
Mark Zarella
Mark Zarella el 4 de Feb. de 2021
Editada: Mark Zarella el 4 de Feb. de 2021
That's what I thought originally as well. But I've confirmed the folder path is correct and that the file formats are supported. The way I did this is by manually running the imread function on the SAME file path and it works fine. And I did this programmatically to ensure the difference wasn't due to manual entry.
Mahesh Taparia
Mahesh Taparia el 4 de Feb. de 2021
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')

Iniciar sesión para comentar.


Steven Lord
Steven Lord el 4 de Feb. de 2021
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.

Categorías

Más información sobre Containers en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by