How to implement a datastore for labeled image sequences?

3 次查看(过去 30 天)
I am fairly new to the datastore format, having only used imagedatastore before. However, now my dataset is a large set of 16x8x800 image sequences each with a single categorical label.
I am using this for deep learning, so I would like to have a datastore that is setup so that each {16x8x800} sequence is paired with a single {[label]}, both of which are formatted so that they can be imported directly by the trainNetwork function.
I was thinking I should just use a filedatastore and save a cell array containing the many image series in the first column and their corresponding label in the second column, like below.
Data{1} = {16x8x800 double, 1x1 categorical}
Data{2} = {16x8x800 double, 1x1 categorical}
.
.
.
Data{n} = {16x8x800 double, 1x1 categorical}
Would this be usable by the trainNetwork function? Is there a better way to perform this?

采纳的回答

Prateek Rai
Prateek Rai 2021-10-10
To my understanding, you want to create a datastore from dataset which is a large set of 16x8x800 image sequences each with a single categorical label.
You can keep all your files in one folder and use imageDatastore to create a datastore. Set 'LabelSource' Name-value pair to "none" to keep the "Label" property empty initially.
% location specifies location of the folder containing all images
imds = imageDatastore(location,'LabelSource','none');
Now, create a categorical array of size (n,1) where ith row indicates label of ith image.
Set this categorical array to "Labels" property of imds.
imds.Labels = x; % here, x is the categorical array of label
You can refer to imageDatastore MathWorks Documentation page to learn more on datastore for image data.
  1 个评论
Thomas Hyatt
Thomas Hyatt 2021-10-14
编辑:Thomas Hyatt 2021-10-14
Thanks for this response, but what save format does one use on a 16x8x800x1 image series? (I forgot to include these images were grayscale) Or rather, a 3D image input. Can I save each as just a .mat file?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by