Can "feedforwardnet" and "patternnet" accept images (2-D or 3-D) as inputs?

1 view (last 30 days)
Can "feedforwardnet" and "patternnet" accept images (2-D or 3-D) as inputs? It seems in all the examples I have seen, they are only able to accept 1-D vectors of feature values as inputs

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Nov 2025 at 0:00
Edited: MathWorks Support Team on 10 Nov 2025 at 11:53
The input data for training classical neural networks is expected to be an R x Q dimensional matrix (or a cell array of R x Q matrices), where Q is the batch size or number of observations and R is the number of variables. So "feedforwardnet" and "patternnet" can only accept inputs that are each 1D.
I recommend you try our deep learning functionalities. Deep learning networks are now the state of the art for image classification/regression (as opposed to classical/shallow neural nets such as patternnet and feedforwardnet) and have also been developed with good GPU performance in mind. Note that are our deep learning networks currently only support 2D data (or 3D data reshaped into 2D). Here are some links with information on our deep learning:
Depending on the data, the best option might be to use convolutional neural networks (CNNs). These networks are designed to model spatial dependencies between variables/features and are the state-of-the-art for tasks such as image classification.
Please see here how to create a simple classification deep learning network for 2-D image data:

More 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!