Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cluster(Mat) function taking too long

Hello everyone, I'm trying to make a dictionary using BOWKMeansTrainer class: i have 63 images for training of different size, but the average size is around 700x900 pixels. The function cluster(...) is actually taking a lot of time, it's already 5 hours that is running. How much do you think I still have to wait? Is there a way to make it faster?

int dictSize = 400;
TermCriteria tc(1, 100, 0.001); //term criteria type, 100 iterations with 0.001 accuracy
int retries = 1;
int flags = KMEANS_PP_CENTERS;
printf("Kmeans Clustering descriptors \n");
BOWKMeansTrainer bowTrainer(dictSize, tc, retries, flags); //create a Trainer
Mat myDictionary = bowTrainer.cluster(newFeatures); //start clustering
printf("dictionary rows = %d  cols = %d\n", myDictionary.rows, myDictionary.cols);
FileStorage fs("myDictionary.yml", FileStorage::WRITE); //store dictionary in a file
fs << "vocabulary" << myDictionary;
fs.release();