how do you format the data for a 3d convolutional network, trainNetwork

1 次查看(过去 30 天)
I have grey scale images that I want to run as groups in the trainNetwork function (an image3dInputLayer). The data is stored in a
row x column x images in stack x number of stacks format e.g. 10 x 10 x 100 x 50 are 50 stacks of 10 pixel x 10 pixel images with 100 images per stack. The images are grey scale. The evaluation data is 1d array of 0 or 1 (i.e. true or false). When I run my code, I get the error that the number of observations in X and Y disagree. However, the observation data structure (X) and the evaluation data structure (Y) have the same number of elements - at least in one dimension. I trust the problme is how the data is shaped, but I havent been able to figure out what format is needed to satisfy trainNetwork. Is the first dimension the number of observations? Any ideas?

回答(2 个)

Sahil Jain
Sahil Jain 2021-10-18
Hi. The "image3dInputLayer" expects 4 dimensions per image (height, width, depth and channels). Therefore, the 10x10x100x88 array which you have made represents a single 3d image. To get this to work, you can reshape it to a 10x10x100x1x88 array. This represents 88 3d images with one channel. You can find more information about the input formats in the "images" subsection of the "Input Arguments" section on the "trainNetwork" documentation page.

JG
JG 2021-10-18
Thank you. Missing the extra dimesion was the problem.

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by