How to implement a datastore for labeled image sequences?

조회 수: 22 (최근 30일)
Thomas Hyatt
Thomas Hyatt 2021년 10월 7일
편집: Thomas Hyatt 2021년 10월 14일
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개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by