Table for neural network regression

4 visualizaciones (últimos 30 días)
Shin-yee Lu
Shin-yee Lu el 20 de Ag. de 2019
Comentada: Shin-yee Lu el 26 de Ag. de 2019
I made a table for neural network regression,
regNet = trainNetwork(trData,'Percent',layers,options), and gor the following error
Error using trainNetwork (line 165)
Invalid training data table for regression. Predictors must be in the first column of the table, as a cell array of image paths or images.
The Table, .txt file, I made has two variables, a string and a double, The first two rows looks like this. I thought they look exactly as in the tutorial .
fileNames,Percent
C:\Users\181620\SCF\iMEC\Data\regData\s7_x8y28_x8500y2800_1_1.png,68.6
C:\Users\181620\SCF\iMEC\Data\regData\s7_x8y28_x8500y2800_1_2.png,68.6

Respuesta aceptada

Sourav Bairagya
Sourav Bairagya el 23 de Ag. de 2019
To retrieve the data from the text file, you can use “readtable” function in this way:
tbl=readtable('test.txt','Format','%s%f');
This will save the data in the desired format.
In “trainNetwork” function, you can provide a table as input but in this table first column[KP1] should contain the ‘Predictor’ information corresponding to each observation. Here, each row corresponds to each separate observation. Now, Predictor can be absolute/relative file path to an image, specified as a character vector or any image specified as a 3D numeric array. 2nd input is the ‘responseName’ which is in this case is ‘Percent’.
Now, after defining your network (“layers”) and training options (“options”) you can use this:
net = trainNetwork(tbl,'Percent',layers,options);
  1 comentario
Shin-yee Lu
Shin-yee Lu el 26 de Ag. de 2019
Add format to read table solved the problem. Thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by