Content based image classification with the bag of visual words model in Python

Even with ever growing interest in deep learning I still find myself using the bag of visual word approach, if only to have a familiar baseline to test my new fancy algorithms against. I especially like the BoW demo script from the VLFeat team, that reaches a solid 65% accuracy on the, admittedly outdated, Caltech101 dataset. The script has the advantage that it is contains all the usual steps in one script (feature extraction, training of the classifier and evaluation of the whole pipeline) and that it can also be easily adapted to other datasets.

The only problem was, that it is a Matlab script and Matlab licences are in my experience often scarce due to their high price even for research institutes. So I rewrote the script in Python using the uncomplete VLFeat Python wrapper.

You can find my code as usual on github:

In case you are just diving into the world of BoW I recommend my minimal BoW image classifier code, which might be easier to understand.

Book: Programming Computer Vision with Python

Book cover: Programming Computer Vision with Python

In case anyone missed it, you can download a very mature draft of “Programming Computer Vision with Python” at This book takes a fresh approach at introducing people to the computer vision field. It is aimed at beginners, who have some programming experience (not necessary Python) and basic understanding of linear algebra (matrices and vectors) and analysis.

The covered topics are (as taken from the TOC):

  • Basic Image Handling and Processing
  • Local Image Descriptors
  • Image to Image Mappings
  • Camera Models and Augmented Reality
  • Clustering Images
  • Searching Images
  • Classifying Image Content
  • Image Segmentation
  • OpenCV

What I like the most are the mini project like programming your own little augmented reality app or building a complete web app for content based image search. It is always great to have little working demos to show to your friends. I will definitely recommend it to anyone new and interested in the computer vision field.

The author, Jan Erik Solem, is Associate Professor at Lunds Universitet and co-founder of PolarRose, a facial recognition software company which was bought by Apple in September 2010.

You can buy the book from July on at or download, as said, the draft from the book’s website.

Collabgraph [Follow up]

Black Hole

When collabgraph divides by 0
from @nelas

I was stunned to see that more than 600 people had tried collabgraph in the past months. This is a huge number considering my expectations and its niche use case. So thank you for taking the time and leaving feedback!

Developing collabgraph and taking part in mendeley’s binary battle was a great experience. And without your support I wouldn’t have made it into the TOP10. I am especially grateful to all, who voted for me in the final vote!

And these black holes are created by papers with hundreds of authors, which is apparently quite common in the genome research society.

Use all the cores!

Use all the cores

Use all the cores with GPGPU and HPC

The last months I have been diving into GPGPU programming with (Py)CUDA. Everytime you are working with images you are faced with huge amounts of data, so more speed is always welcome. CUDA promises speedups up to 300x, but this comes with a price of having to implement more or less everything yourself on a low level. In times this can be very challenging, so to cheer me up in the hard times I made this picture based on a popular internet meme. I also think the GPGPU and HPC community is in need of some catchy visuals.  Read more about this and other memes at Know Your Memes, X all the Y.

Let me know, what you think and spread it!

Vote for Collabgraph!

For the people who don’t follow me on Twitter:

Collabgraph made it into the Top10 of Mendeley’s Binary Battle!

I am really proud, especially considering the high quality of all the other contenders. But if you tried Collabgraph and found it useful or fun, I would be more than happy if you’d vote for me! The public votes and the decision of the (surprisingly high profile) judges will be aggregated to select the winner. The first price consists of 10.000$, 1,000 Amazon Web Services Credits and limitless fame! So please, if you liked it

Vote for Collabgraph!  😀

Computer Vision News

I created Computer Vision News (CVN), an aggregator for all the events and academic vacancies within the field of Computer Vision, ImageAnalysis, and Medical Image Analysis. You can also follow it on Twitter @compvisionnews!

At the moment I use following sources:

Please write me, if you have sources I should add. I am happy to extend CVN.
I prefer just to have the headlines in my Twitter timeline, where they don’t clutter my mail client or my feedreeder. But use it as you like! Yeah! for more choices!

Who is collaborating?

Collaboration graph of master thesis created with collabgraph

In my scarce spare time, I have written Collabgraph to visualize connections between authors of scientific publications.

This python script reads a (your) bibtex file and draws a graph in which all the nodes are authors and the edges represent that the two authors have collaborated (or at least wrote a paper together).

On the right is the graph created by from the references used in my diploma thesis.  You can immediately see what central role Eakins, Meier and Flickner played.
Collabgraph requires only the pygraphviz library, which can installed with “easy_install pygraphviz”.

You can find the sourcode and the example at

I am looking forward to your feedback!!!