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.
댓글 수: 0
답변 (2개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!