I cannot manage to load in a training/validation set using the Deep Learning Toolbox. (using tif file/multidimensional array)
1 次查看(过去 30 天)
显示 更早的评论
Hi!
I have been trying all day to load in a set of images to be used in a convolutional neural network using the Deep Learning Toolbox.
I have a tif file containing 3000 images of 60x60 pixels (gray values). I have the same image data as a variable in my workspace in a 60x60x3000 multidimensional array of sequential images.
When I browse to my tiff file in the following application box, it does not show my tif file. (as if the file is incompatible)
When I select 'Data source: workspace', it says 'No ImageDatastore variable in workspace'.
When I try to make the ImageDatastore variable it gives errors:
filepath = 'C:\Users\CNNData\CNNImages'
imds = imageDatastore(filepath,'FileExtensions','.tif')
I get the error 'Cannot find files or folders matching:'
I think I am not fully understanding how I have to load in images. Anyone knows what im doing wrong? :)
0 个评论
回答(1 个)
T.Nikhil kumar
2023-10-12
编辑:T.Nikhil kumar
2023-10-12
Hello Kevin,
I understand that you have your image data as a multi-dimensional array in your workspace (60x60x3000), and as a “tiff” file, and want to import this image data into the Deep Network Designer App for training a CNN.
The Deep Network Designer App is designed to work with image data in the form of folders or ‘imageDatastore’ object and not in any other format. Also, if we use the ‘imageDatastore’, it should contain labels for each image. For creating an ‘imageDatastore’ object, we would require all the images to be saved in files and have a file path name. So, ultimately it would be beneficial to save the images as files to work with them in the Deep Network Designer App.
One way to perform this is by saving each image in the multi-image “tiff” file as a separate image file and then creating the ‘imageDatastore’ from the directory containing these image files.
You can use the ‘imread’ function to read images index wise from the “tiff” file and use ‘imwrite’ function to write each image array into a new image file. Later, store these file paths as a string array or a cell array of character vectors and pass it as an input to the ‘imageDatastore’ function with ‘LabelSource’ argument set to ‘foldernames’.
You can refer to the following documentation about ‘imread’ and imwrite’ to help you solve proceed further:
You can refer to the attached MATLAB Answers Forum question for information on a similar issue:
Hope this helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!