CANNOT make an image prediction after trainning a CNN network

1 Ansicht (letzte 30 Tage)
Jie
Jie am 10 Nov. 2022
Beantwortet: Sanjana am 7 Jun. 2023
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'}

Antworten (1)

Sanjana
Sanjana am 7 Jun. 2023
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!

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by