I'm interested in learning a topic model from a bag of visual words for image retrieval. I can compute V cluster centers (visual words) of SIFT descriptors at keypoints for each training image and fit, for example, an LDA topic model for a collection of training images. This will produce a set of topics and topic proportions for each training image. Now, given a new test image, I want to figure out what the topic proportions of that image are using already learned topics so I can retrieve the closest image from the training set. Is there a simple way of doing that?

  • $\begingroup$ By "simple way," are you asking for an implementation of LDA that does this, or for a description of the math so that you may implement this yourself? $\endgroup$ – Sean Easter Mar 29 '16 at 22:01
  • $\begingroup$ if there is existing implementation that I can understand and use: great! If not I'd like to understand and implement it myself. $\endgroup$ – Vadim Smolyakov Mar 30 '16 at 23:17
  • $\begingroup$ To my recollection, gensim has a means of transforming data this way. Also, sklearn's LDA implementation has a transform method, which you could use on your test data following whatever other processing steps you have to perform. (I don't fully grasp the details of your feature extraction process.) To the math part, I'll try to conjure an answer when I have time and the LDA paper to hand. $\endgroup$ – Sean Easter Mar 31 '16 at 13:49
  • $\begingroup$ Yes. Looks like they are both based on on-line variational bayes method for learning the topics. I briefly looked at the source for transform method in sklearn's LDA: looks like they are using an E-step to transform the data. I'll take a look in more detail. Adding the links: gensim and scikit Thanks! $\endgroup$ – Vadim Smolyakov Mar 31 '16 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.