Borrar filtros
Borrar filtros

X and Y do not have the same number of observations.

9 visualizaciones (últimos 30 días)
sun rise
sun rise el 5 de Sept. de 2021
Comentada: Walter Roberson el 26 de Sept. de 2021
setup_folders;
sadtrdinfo = dir(sad1train); % Returns both folders and files
% sad = dir(pwd); % Returns both folders and files
sorted_cell_array_of_train_folder_names = setdiff({sadtrdinfo([sadtrdinfo.isdir]).name},{'..','.'}); % Select folder names
% cell_array_of_train_folder_names( strncmp( cell_array_of_train_folder_names, ".", 1 ) ) = []; % Remove '.' and '..'
%sorted_cell_array_of_train_folder_names = sort_nat( cell_array_of_train_folder_names );
% sorted_cell_array_of_train_folder_names = cell_array_of_train_folder_names; % if you don't have sort_nat
whos sorted_cell_array_of_train_folder_names
%----------------
np = numel(sorted_cell_array_of_train_folder_names); % number of subfolders
train_cats = categorical(sorted_cell_array_of_train_folder_names);
Group_Train1 = cell(np,1);
for i = 1 : np
SFN = sorted_cell_array_of_train_folder_names{i};% extract his name
traintifpattern = fullfile(sad1train, SFN, tiffwild);
tifListdinfo = dir(traintifpattern); % list all jpg files
tifList = fullfile({tifListdinfo.folder}, {tifListdinfo.name});
ms1 = numel(tifList); % ms = number of image files found
Group_Train1{i} = repmat(train_cats(i), ms1, 1);
end
Group_Train1 = vertcat(Group_Train1{:});
save('Group_Train','Group_Train1');
>> HOG2
Error using classreg.learning.FullClassificationRegressionModel.prepareDataCR (line 231)
X and Y do not have the same number of observations.
Error in ClassificationSVM.prepareData (line 632)
classreg.learning.FullClassificationRegressionModel.prepareDataCR(...
Error in classreg.learning.FitTemplate/fit (line 217)
this.PrepareData(X,Y,this.BaseFitObjectArgs{:});
Error in ClassificationSVM.fit (line 240)
this = fit(temp,X,Y);
Error in fitcsvm (line 334)
obj = ClassificationSVM.fit(X,Y,RemainingArgs{:});
Error in multisvm (line 29)
models{k} =
fitcsvm(TrainingSet,G1vAll,'KernelFunction','polynomial','polynomialorder',3,'Solver','ISDA','Verbose',0,'Standardize',true);
Error in HOG2 (line 37)
result1= multisvm(Feat1,Group_Train1,Feat2,Group_Test1);
>>
Note that the actual number of photos is 26770
  1 comentario
Walter Roberson
Walter Roberson el 5 de Sept. de 2021
We do not know how you read in the files to create Feat1 .
In particular, we do not know that you re-created both Feat1 and Group_Train1 after any change to the directory.

Iniciar sesión para comentar.

Respuesta aceptada

yanqi liu
yanqi liu el 26 de Sept. de 2021
sir, may be use libsvm toolbox can much faster
  1 comentario
Walter Roberson
Walter Roberson el 26 de Sept. de 2021
Unfortunately that will not solve problems with the number of samples being wrong.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by