How can we increase the training set?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
This is the code :
if true
for digit = 1:numel(trainingSet)
numImages = trainingSet(digit).Count;
features = zeros(numImages, hogFeatureSize, 'single');
for i = 1:numImages
img = rgb2gray(read(trainingSet(digit), i));
img = imbinarize(img);
features(i, :) = extractHOGFeatures(img, 'CellSize', cellSize);
end
labels = repmat(trainingSet(digit).Description, numImages, 1);
trainingFeatures = [trainingFeatures; features];
trainingLabels = [trainingLabels; labels ];
end
end
Here it is picking data set from 0-9 folders only, what can we do to increase the data set?, when we are increasing the folders in training set it is giving error as :
Error using vertcat Dimensions of matrices being concatenated are not consistent.
Kindly help that how can we increase the folders in training set???? and how can read all folders in given training set
0 Kommentare
Antworten (1)
Phil
am 5 Jun. 2017
Bearbeitet: Phil
am 5 Jun. 2017
I think this is the line that produces the error:
trainingLabels = [trainingLabels; labels ];
But the problem is with this line:
labels = repmat(trainingSet(digit).Description, numImages, 1);
When you include images that have the description '10', repmat produces a numImages x 2 char array, NOT a numImages x 1 char array. You then vertically concatenate that 2-column array with the trainingLabels array, which only has 1-column, hence the error.
To fix this, you can either convert the labels to strings, if that's appropriate for your application; or you can ensure that the number of columns in labels is always two by beginning single digit labels with a zero.
Hope this helps.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!