SplitEachLabel Error for divide Images into Train and Test Data for Faster R-CNN
19 次查看(过去 30 天)
显示 更早的评论
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 个评论
Julian Lopez Baasch
2018-12-6
编辑:Julian Lopez Baasch
2018-12-6
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.
回答(1 个)
Obaid Rafiq Jan
2020-11-26
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 个评论
Krishnapuram Nithinsai
2023-8-29
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Datastore 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!