Cluster(Mat) function taking too long

asked 2020-06-26 09:16:00 -0500

albeh95 gravatar image

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();
edit retag flag offensive close merge delete

Comments

what's dictionary.size() ? (it's not the image dims, which matter here)

and yea, kmeans clustering is a known cpu hog, and it gets worse with increasing descriptor length;(

berak gravatar imageberak ( 2020-06-26 11:01:27 -0500 )edit
1

It has finished one half hour later I posted the question here, luckly it's a process that I'm suppose to do only one time... I guess I have to accept th slowness of kmeans clustering...

albeh95 gravatar imagealbeh95 ( 2020-06-26 12:33:03 -0500 )edit