What input type for image3dInputLayer
Show older comments
Hi all,
I'm trying to build a classification network using 3-D images as input. However, I can't get the image3dInputLayer to work.
So far, i've used a folder structure with images sorted per classolution in subfolders. As file types I tried a layered tif (which trows an error since it is recognized as a 2-D image), or .mat files each containing a single 570x570x356 matrix.
Could anyone give me a suggestion on how to prepare the input data?
Thanks in advance,
Daan
1 Comment
Tomaso Cetto
on 30 Sep 2021
Hey Daan,
The image3dInputLayer expects data with 3 spatial dimensions and one channel dimension - the inputSize argument ot the layer is in the format [h w d c], where [h w d] are the sizes of the spatial dimensions of the images (which, if I understand correctly is [570 570 356], for your data). If your imags are grayscale, then you'll have c = 1.
That said, the best way for you to input your images into a network will be using datastores (the images are big and so depending on how many you have it'll most probably not be feasible to hold them in-memory). I suspect the datastore you'll want to be using is the imageDatastore.
Hopefully the documentation for this function helps you get started - we also have a documentation example which shows a semantic segmentation workflow using 3-D images. If you're not planning on doing segmentation, there is a bunch of stuff in this example you won't need to worry about, but I mention it because it starts by creating an imageDatastore from the 3D images (and shows how to read them from MAT-files), so that might be of help to you as well.
I hope this helps!
Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!