shuffle and partition in training, validation and testing of a multi-label combined dataset

3 次查看(过去 30 天)
I want to train a Faster R-CNN with 224x224x3 images that are log-scaled mel spectrograms from the UrbanSound8k dataset
The data is already labeled with rectangles.
here's my code:
%% imds* are M x 2 tables, 1st column 'imageFileName' 2nd 'label_name' with [x,y,height,width] of the rectangular ROIs
%% Dataset Extraction: Label tables combining
airConditionerLbl = imdsAirConditioner(:,2:end);
carHornLbl = imdsCarHorn(:,2:end);
childrenPlayingLbl = imdsChildrenPlaying(:,2:end);
dogBarkLbl = imdsDogBark(:,2:end);
drillingLbl = imdsDrilling(:,2:end);
engineIdlingLbl = imdsEngineIdling(:,2:end);
gunShotLbl = imdsGunShot(:,2:end);
jackhammerLbl = imdsJackhammer(:,2:end);
sirenLbl = imdsSiren(:,2:end);
streetMusicLbl = imdsStreetMusic(:,2:end);
%% Combining into boxLabelDs
blds = boxLabelDatastore(airConditionerLbl,carHornLbl,childrenPlayingLbl,dogBarkLbl,drillingLbl,engineIdlingLbl,gunShotLbl,jackhammerLbl,sirenLbl,streetMusicLbl);
%% extract imagesFileName from tables
airConditionerFiles = imdsAirConditioner.imageFilename;
carHornFiles = imdsCarHorn.imageFilename;
childrenPlayingFiles = imdsChildrenPlaying.imageFilename;
dogBarkFiles = imdsDogBark.imageFilename;
drillingFiles = imdsDrilling.imageFilename;
engineIdlingFiles = imdsEngineIdling.imageFilename;
gunShotFiles = imdsGunShot.imageFilename;
jackhammerFiles = imdsJackhammer.imageFilename;
sirenFiles = imdsSiren.imageFilename;
streetMusicFiles = imdsStreetMusic.imageFilename;
%% create the imageDatastore
imds = imageDatastore([airConditionerFiles;carHornFiles;childrenPlayingFiles;dogBarkFiles;drillingFiles;engineIdlingFiles;gunShotFiles;jackhammerFiles;sirenFiles;streetMusicFiles]);
%% combine the datastores
cds = combineDatastore(imds,blds);
I want to shuffle and split the data into training, validation and testing and I don't know how and where I can do it in this code.
Can anyone help me?
Thank you.

回答(2 个)

Claudio Eutizi
Claudio Eutizi 2021-1-18
编辑:Claudio Eutizi 2021-1-18
Can anybody help me with this?

Srivardhan Gadila
Srivardhan Gadila 2021-1-30
You can refer to the documentation of the functions partition & shuffle. For the list of other functions supported by the CombinedDatastore object you can refer to Object Functions of the CombinedDatastore.

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by