combined datastore for regression model with multiple input

3 Ansichten (letzte 30 Tage)
Mariko Okada
Mariko Okada am 22 Nov. 2019
Beantwortet: Jayanti am 25 Mär. 2025
I need combined datastore like below:
data = read(ds)
data =
100×3 cell array
{128×128×3 uint8} {128×128×3 uint8} {[0.8]}
{128×128×3 uint8} {128×128×3 uint8} {[1.2]}
{128×128×3 uint8} {128×128×3 uint8} {[4.4]}
{128×128×3 uint8} {128×128×3 uint8} {[0.9]}
...
Fist column and second column are (multiple) input data for CNN,
and last column is responses.
(As stated in the docmentation, For networks with multiple inputs, the datastore must be a combined or transformed datastore that returns a cell array with (numInputs+1) columns containing the predictors and the responses, where numInputs is the number of network inputs and numResponses is the number of responses.)
I prepared two kinds of image file folder, which are corresponding to first column and second column.
The problem is about third column.
I prepared .csv file of the response values, and made a tabularTextDatastore with the file.
And then I transformed it to cell type data in order to combine it with the other two datastores.
dsnew = transform(ds,@(x) table2cell(x))
But after combine these three datastores, ds.readall comand showed an error about horzcat, which tells that demensions of the arrays are not consistent.
I confirmed the dimensions of all datastores, but all of them are "1000 x 1 cell array".
How can I solve this problem?
  2 Kommentare
Nimit Dhulekar
Nimit Dhulekar am 18 Mär. 2020
Hi Mariko, what is the ReadSize for the TabularTextDatastore? It is possible that the ReadSize is set to its default value of 20000 and that is what is tripping up the readall horzcat.
Can you please post the code you used to construct the 3 datastores.
Ziqi Wu
Ziqi Wu am 23 Sep. 2022
found another thread here might be helpful, convert to table data type
https://www.mathworks.com/matlabcentral/answers/372698-deep-learning-how-do-i-add-regression-ground-truth-data-to-an-imagedatastore#answer_297023

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jayanti
Jayanti am 25 Mär. 2025
Hi Mariko,
The issue might be due to the different read size properties of all the datastores. To resolve this, keep the same read size value for all underlying datastores.
You can also refer to below similar matlab answer for your reference:

Community Treasure Hunt

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

Start Hunting!

Translated by