How to import three dimensional hyperspectral data (.mat) into Deep learning toolbox?

1 view (last 30 days)
I am using Deep Network Designer (DND). I have three folder, filled with .mat files. These .mat files are cropped hyperspectral images of dimension (X,Y, 214). Here X and Y are image dimension which vary with every image and 214 is the number of channels or bands and is constant in all the images.
I was having no problem in importing these data using the function imagedatastore. But, I am facing these two problems.
  1. While importing the images is successful. I cannot view them on the DND dialog window.
2. When I try to train the model. I get an error that the input images need to be 3D.
If I open these individual matfiles using hyperspectralViewer. There is no problem.
Attached is the code that I have used to create the datastore and the network image.
Trainimds = imageDatastore("location of directory","FileExtensions",".mat","LabelSource","foldernames","IncludeSubfolders",true);
the network image

Answers (1)

Parth Parikh
Parth Parikh on 23 Mar 2023
Edited: Parth Parikh on 23 Mar 2023
Hi Billy,
For the first issue, you can try using fileDatastore. As mentioned that you have 3 folders, contain all .mat files.
fds = fileDatastore(<path>, "ReadFcn", @load, "FileExtensions", ".mat");
For the second error,
It looks like you are passing 4D input to "image3dInputLayer".
image3dInputLayer([X Y 214 1], 'Name', 'Input');
If you wish to learn more about hyperspectral imaging, please have a look at the below links:

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!