How can we increase the training set?
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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 件のコメント
回答 (1 件)
  Phil
 2017 年 6 月 5 日
        
      編集済み: Phil
 2017 年 6 月 5 日
  
      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 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Characters and Strings についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

