0

I'm using GMM to fit my data to 256 Gaussians. I'm using Matlab's fitgmdist to achieve this.

gmm{i} = fitgmdist(model_feats, gaussians, 'Options',statset('MaxIter',1000), ...
            'CovType','diagonal', 'SharedCov',false, 'Regularize',0.01, 'Start',cInd);

I am using RootSIFT to extract the features of each image. This produces a vector of 1x128 for each image.

Now I have 45 images maximum for each writer. So after feature extraction and everything the size of my model_feats is 45 x 128.

According to the help file for data arrangement for X is:

The rows of X correspond to observations, and columns correspond to variables.

The problem I have is when I run the above function I am told that:

"X must have more rows than columns."

I have a total of 45 images for each writer. How will I be able to get this function to run? This is a strange limitation for such a function, I mean even if I am able to get 100 images for each writer it will not work.

I will appreciate any workaround to this.

P.S. I've tried the same with VL_Feat's vl_gmm and it works without any problems but I need this to work in Matlab not VL_FEAT.

StuckInPhDNoMore
  • 2,507
  • 4
  • 41
  • 73
  • I don't know what those tools are, but have you tried fooling it into running by making 3 copies of each instance (observation)? – IVlad Feb 27 '15 at 16:27
  • Thanks but that would corrupt my output results. I could fool the function in other ways but that would not give me accurate results I need for classification – StuckInPhDNoMore Feb 27 '15 at 16:39
  • Methods using covariance will be unstable if you have less instances than variables. They will overfit; you should have much much more instances than dimensions. – Has QUIT--Anony-Mousse Feb 27 '15 at 18:02
  • Right that makes more sense as to why it refuses to work. Since I do not have any more instances, is my only solution to use a feature extractor thats smaller than my instances? Or can I dimensionally reduce the current feature vectors to work?(I have no experience in dimensionality reduction, maybe pca or lda?) – StuckInPhDNoMore Feb 27 '15 at 18:25
  • Are you computing a single SIFT vector per image? That won't do the trick. Also, you would use *all* images at the same time, not only of one "writer"(?). Have a look at the VLFeat documentation: http://www.vlfeat.org/api/dsift.html – Has QUIT--Anony-Mousse Feb 28 '15 at 11:04
  • @Anony-Mousse Thanks, yes, I am using SIFT but I dont understand why I should use all images of the writer at the same time? The documentation states, "optionally repeat for more images" and even if I do concatenate for all images my problem would still exist as the rows will stay 45 but the columns will be equal to the keypoints descriptors which will surely be more than 45. – StuckInPhDNoMore Feb 28 '15 at 21:11
  • 2
    No, you are supposed to treat *every keypoint in the image* as a separate instance. At this point, you are probably supposed to cluster *keypoints not images*. To build your vocabulary. – Has QUIT--Anony-Mousse Feb 28 '15 at 21:29
  • @Anony-Mousse Clustering keypoints was what I should have been doing. Thank you. If you add this as an answer I'll accept it. Thanks again for your suggestion – StuckInPhDNoMore Mar 05 '15 at 23:17

1 Answers1

1

With SIFT you usually don't compute the feature for the whole image, but literally hundreds of keypoints for each image. Then you won't have this problem anymore.

Next step then probably is a “bag of visual words” mapping of each image.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194