Error using vision.internal.Kdtree/index Invalid input class.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Error using bagOfFeatures. It was earlier working fine but suddenly it stopped. I am using custom extractor function.
extractorFcn= @calcFeatures;
bag = bagOfFeatures(trainingSet,'CustomExtractor',extractorFcn,'VocabularySize',500);
% function [T, TMetric] = calcFeatures(pic) Custom Extractor looks like this
The Error I get is:
Clustering...completed 0/100 iterations Error using vision.internal.Kdtree/index
Invalid input class.
Error in vision.internal.approximateKMeans>assignDataToClustersSerial (line 172)
searcher.index(centers);
Error in vision.internal.approximateKMeans>assignDataToClusters (line 153)
[assignments, dists, varargout{1:nargout-2}] = assignDataToClustersSerial(features, centers, randState);
Error in vision.internal.approximateKMeans (line 73)
[assignments, dists, isValid] = assignDataToClusters(features, centers, params);
Error in bagOfFeatures/createVocabulary (line 640)
clusterCenters = vision.internal.approximateKMeans(descriptors, K, ...
Error in bagOfFeatures (line 197)
this.Vocabulary = this.createVocabulary(descriptorSet, ...
11 Kommentare
Walter Roberson
am 22 Okt. 2018
I chopped out a lot of images and was able to trigger the input class problem you mention. Unfortunately it also triggered a MATLAB kernel crash, so I am trying again.
Raju Pal
am 23 Nov. 2019
I have faced the problem in knn search when using alexnet features
* Clustering...completed 0/100 iterations Error using vision.internal.Kdtree/index
Invalid input class.
Error in vision.internal.approximateKMeans>assignDataToClustersSerial (line 172)
searcher.index(centers);
Error in vision.internal.approximateKMeans>assignDataToClusters (line 153)
[assignments, dists, varargout{1:nargout-2}] = assignDataToClustersSerial(features, centers, randState);
Error in vision.internal.approximateKMeans (line 73)
[assignments, dists, isValid] = assignDataToClusters(features, centers, params);
Antworten (2)
Walter Roberson
am 23 Okt. 2018
Digging into this: that error is being triggered by the fact that the features array that vision.internal.approximateKMeans is being asked to work on is a single column; it is expecting a minimum of two columns.
I am still tracing through to figure out what the one column is at that point, and why it is not multiple columns.
2 Kommentare
Walter Roberson
am 23 Okt. 2018
Your exampleBagofFeaturesExtractor uses activations('OutputAs','rows'), which is going to return either a vector or a 2D array. But the next line does
features=reshape(trainFeatures,[size(trainFeatures,1)*size(trainFeatures,2)*size(trainFeatures,3),size(trainFeatures,4)]);
which will reduce anything of less than 4 dimensions into a column vector.
There is a transpose in the next line, but it is commented out, so the output is a single column.
If the output were a row instead of a column, then that would have succeeded in the approximateKMeans -- just watch out for which dimension you are taking the feature metric relative to.
Suvidha Tripathi
am 23 Okt. 2018
Yes, You are right. I ran the example code by MATLAB, and figured out the error yesterday. I corrected it by reshaping my array like this
features=reshape(trainFeatures,[size(trainFeatures,1)*size(trainFeatures,2) ,size(trainFeatures,3),size(trainFeatures,4)]);
This worked for me. Thank you for your time.
Dr. Murtaza Ali Khan
am 23 Jan. 2019
I got the same error when my features matrix was of size M-by-1 in the custom feature extractor function. I changed it to size 1-by-M then the error did not appear.
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!