How to implement a datastore for labeled image sequences?
9 次查看(过去 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?
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!