How to implement a datastore for labeled image sequences?
9 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Prateek Rai
on 10 Oct 2021
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!