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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/768456/image.png)
0 个评论
回答(2 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!