how i can remove follwing error in the given code? Error using bagOfFeatures/parseInputs (line 1023) The value of 'imgSets' is invalid. Expected imgSets to be one of these types: imageSet Instead its type was matlab.io.datastore.ImageDatastore.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
outputFolder = fullfile(tempdir, 'caltech101'); rootFolder = fullfile('D:\OLD L\DATASET\caltech101', '101_ObjectCategories'); categories = {'airplanes', 'ferry', 'laptop'}; imds = imageDatastore(fullfile(rootFolder, categories), 'LabelSource', 'foldernames'); tbl = countEachLabel(imds) %% Prepare Training and Validation Image Sets minSetCount = min(tbl{:,2}); % determine the smallest amount of images in a category
% Use splitEachLabel method to trim the set. imds = splitEachLabel(imds, minSetCount, 'randomize');
% Notice that each set now has exactly the same number of images. countEachLabel(imds) %% Separate the sets into training and validation data. Pick 30% of images from each set for the training data and the remainder, 70%, for the validation data. Randomize the split to avoid biasing the results. [trainingSet, validationSet] = splitEachLabel(imds, 0.3, 'randomize'); bag = bagOfFeatures(trainingSet); img = readimage(imds, 1); featureVector = encode(bag, img);
% Plot the histogram of visual word occurrences figure bar(featureVector) title('Visual word occurrences') xlabel('Visual word index') ylabel('Frequency of occurrence')
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!