CANNOT make an image prediction after trainning a CNN network

3 次查看(过去 30 天)
After I trained the CNN following the Matlab document, I get a net variable which represents the network. However when I tried to use it to predict new pictures, I read the image which size is 128 by 128 and used net(imgTEST), however it firstly hinted that Array indices must be positive integers or logical values. So I binarized the image and net(imgTEST) again, and then it reported that The logical indices contain a true value outside of the array bounds.
The sizes of pictures I used to train the network are also 128 by 128, so I don't know where goes wrong. Could somebody help? Thank you!
My net's property is given below.
net =
SeriesNetwork with properties:
Layers: [14×1 nnet.cnn.layer.Layer]
InputNames: {'imageinput'}
OutputNames: {'classoutput'}

回答(1 个)

Sanjana
Sanjana 2023-6-7
Hi Jie,
I understand that you are encountering some difficulties with performing predictions on a Test Image with the trained CNN Network.
To perform predictions with a trained CNN Network, which is usually a “dlnetwork” or “DAGNetwork”, you can use “predict” function, with inputs as the network obj and input resized to the size of the network input.
Please refer to the following links, for further information,
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by