SplitEachLabel Error for divide Images into Train and Test Data for Faster R-CNN
4 views (last 30 days)
Show older comments
I have 297 Grayscale images (Drone) and I would Like Divide Them into 3 parts (train-test and validation) for Object Detection Using Faster R-CNN method and I used SplitEachLabel Command in Matlab2018a but after write below codes:
imds = imageDatastore('C:\Users\hosein\My Documents\MATLAB\DroneImages');
[trainds,testds,valds] = splitEachLabel(imds,0.6,0.2,'randomized');
matlab showed error: "Input folders or files contain non-standard file extensions.Use FileExtensions Name-Value pair to include the non-standard file extensions."
and when I wrote this code:
[trainds,testds,valds] = splitEachLabel(imds,0.6,0.2)
matlab showed error:"splitEachLabel requires non-empty Labels property.."
2 Comments
Julian Lopez Baasch
on 6 Dec 2018
Edited: Julian Lopez Baasch
on 6 Dec 2018
Be sure you loaded the data properly. You can check that by computing the data size. Try with
>> size(imds)
If the output is of the shape 0xsomething, then you hadn't load the data properly. Maybe your path is wrong.
Answers (1)
Obaid Rafiq Jan
on 26 Nov 2020
The error is quite straightforward; 'splitEachLabel' requires a label from the 'imageDatastore' object which is not defined in your code. One of the input arguments for 'imageDatastore' is its 'LabelSource', by default it is set to none and you can specify any label if you want, or you can simply let the label definition be 'foldernames' which takes the name of your imageDatastore folder and provides that as the label. You can try:
dataDir = fullfile('C:\Users\hosein\My Documents\MATLAB');
imDir = fullfile(dataDir, 'DroneImages');
imds = imageDatastore(imDir, 'LabelSource', 'foldernames');
[trainds,testds,valds] = splitEachLabel(imds,0.6,0.2);
1 Comment
Krishnapuram Nithinsai
on 29 Aug 2023
flowerds = imageDatastore("C:\Users\krish\OneDrive\Desktop\deeplearning_course_files\RandomImages");
rng default
[trainImgs,testImgs] = splitEachLabel(flowerds,0.6,"randomized");
//I'm getting same error too
See Also
Categories
Find more on Datastore in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!