フィルターのクリア

How to prepare imagedatastore for Image to single value regression

3 ビュー (過去 30 日間)
qi lu
qi lu 2020 年 8 月 5 日
編集済み: David 2022 年 5 月 11 日
I would like to train a CNN for image regression using a datastore. The output is a single value. I set the Labels in imagedatastore to a value vector(Y_train). But the debug information show the labels in imagedatastore must be a categorical vetcor. Is it possible to use the imagedatastore for regression problems.
ims_train = imageDatastore('F:\imagestore\train_image224', 'FileExtensions', '.tiff', 'Labels', Y_train, 'ReadSize', 128);
% here I defined my network architecture
% here I defined my training options
[net,Info] = trainNetwork(ims_train,lgraph,options);
  3 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 1 月 5 日
編集済み: Cris LaPierre 2021 年 1 月 5 日
Question from Sho Wright
Hi Qi Lu, I'm also trying to use imds and augimds to preprocess images for an image-to-value regression network, could you share your code if possible?
Cris LaPierre
Cris LaPierre 2021 年 1 月 5 日
Qi lu's reply
Sorry. I don't find any solutions or workaround. It seems it's impossible to use imds to solve regression problems since the he labels in imagedatastore must be a categorical vetcor. But the labels in regression problems are values. Now I just load all image in the RAM and process image.

サインインしてコメントする。

回答 (1 件)

Joe Chalfoun
Joe Chalfoun 2021 年 8 月 12 日
編集済み: Joe Chalfoun 2021 年 8 月 12 日
This solution worked for me:
Just get the list of files name from the regular imagedatastore and create a table of two columns, the first one is the files name and the second column is the regression response. You can then input that table to trainNetwork function or for the validation option too, like this:
For training:
[net, info] = trainNetwork(table(ims_train.Files,Y_train),lgraph,training_options);
to add validation data:
options = trainingOptions('ValidationData',table(ims_val.Files,Y_val));
Hope this helps.
  1 件のコメント
David
David 2022 年 5 月 11 日
編集済み: David 2022 年 5 月 11 日
The internet and helpful people save the day. Thank you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by