Clear Filters
Clear Filters

How can I perform k-fold cross validation using an Image category classifier?

3 views (last 30 days)
Hello, I am using bag of features to classify between three different classes of histology images. Instead of splitting my data set in training and validation sets I'd like to perform k-fold cross validation because I have few samples. Can anyone help me on how to do this? It'd be great if you posted some code maybe modifying the example ImageCategoryClassificationExample
  2 Comments
Somaye Ahmadi
Somaye Ahmadi on 9 Jul 2017
Hello. I have the same problem. have you solve that? I've found a code but i couldn't get the results. Try it maybe you would solve that. Before using you need to download VLFeat 0.9.20 binary package. It is so easy to add to Matlab path. If you look at code , for example in bovw_surf function used cross validation (5 folds) and also (imageSets = partition(imageSets, minSetCount, 'randomize');) . Good Luck
Somaye Ahmadi
Somaye Ahmadi on 10 Jul 2017
I used help of Matlab the complete code is there and also here . I want to perform cross validation ( 10 fold or LOOcv). i did partition by
imgSets = partition(imgSets, minClassCount, 'randomize')
and then create loop on traingSets and validationSets to have 10 fold-cv ,but i have this error: Undefined function or variable 'trainingSets'.
Error in (line 91)
bag = bagOfFeatures(trainingSets, 'StrongestFeatures', ratioOfStrongFeatures, 'VocabularySize', numberOfClusters);
seems that trainingSets is not appropriate for bagoffeatures..should i make a loop before i use imgSets? Thanks for any help in advance.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!