How to implement a datastore for labeled image sequences?

22 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Prateek Rai
Prateek Rai il 10 Ott 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.
  1 Commento
Thomas Hyatt
Thomas Hyatt il 14 Ott 2021
Modificato: Thomas Hyatt il 14 Ott 2021
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?

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by