Posts

Showing posts with the label matlab

Python and Matlab bindings for Damascene, Global Probabilty of Boundary on GPU

So I'm still playing around with constrained parametric min-cuts for object segmentation. A major bottleneck of this algorithm is gPb, the global probability of boundary operator from Malik's group. Luckily, there already is a CUDA implementation of gPb out there: Damascene . Damascene provides a command line interface to apply gPb to ppm images. Since I wanted to include it directly with cpmc, I wrote some mex-wrappers for Damascene. And since I would love to see more algorithms done in Python instead of Matlab, I wrote some Python wrappers, too. You can find both, together with the current version of damascene here . You need a working CUDA setup and the acm library to compile it. Set your paths in common.mk and just "make" it. For the matlab wrappers, you also need to adjust the matlab path in "bindings/Makefile" and "make gpb_mex" in that directory. For the python wrappers, you have to compile damascene with "make shared=1...

Matlab weirdness: Creating Logical Arrays and Accessing Sparse Matrices

While trying out the new Constrained Parametric Min Cuts code, I came across some Matlab weirdness. The first situation was this: Given a huge sparse matrix X and some row and column indices r and c, I wanted to pick out these elements. As usual, I called ind=sub2ind(size(X),r,c) Y=X(ind) ... and got an out of memory error. That seemed a little weired, since "ind" wasn't that long. It seemed to me as if the matrix is converted into a full (=dense) matrix before the linear indexing took place. After quite some thinking and searching on the web, I came across a post about the same problem. Apparently the "correct" solution to my problem is: [I J x]=find(X); [tf loc]= ismember([r(:) c(:)],[I J],'rows'); Y = zeros(size(tf)); Y(tf) = x(loc(tf)); why this is so, I have no idea. Maybe someone can clear this up for me. The next thing that really puzzled me was this: At some point in the code, a large logical array has to be generated. This was don...

Segmentation via Constrained Parametric Min Cuts

Joao Carreira and Cristian Sminchisescu released code for their price-winning "Constrained Parametric Min-Cuts for Automatic Object Segmentation" paper - apparently a month ago by I guess I oversaw it so far. It's Matlab code and uses may other publicly available libraries, which are all included in their download. The code is not (yet) compatible with the 32bit (Student) version of Matlab but if Joao includes my patch that shouldn't be a problem. I tested it under Ubuntu with the Student Matlab version on a computer with 12gb Ram and Core i-7 and also on my laptop with 2gb Ram and Core i-5. This will be a very useful tool for everyone working in object segmentation and I am quite excited about this release :)

Python wrappers for vlfeat quickshift

Finally I got around to wrap vlfeats quickshift features to python. These can be used to easily build (hierarchical) segmentations or superpixels in images. They can also be used for other clustering tasks but this was the main goal. You can find my wrappers on github . If you want, you can flattr me. I build upon mmmikaels python wrappers and upgraded to vlfeat 0.9.9. I didn't see if the compiling problems I addressed earlier are still present in this version but I'll check it and try to fix it in my branch. I am planing to use this together with the sift features for some superpixel and bow based image segmentation. Before that I used Turbo Pixels by Alex Levinshtein. Maybe I will write some python wrappers for his Matlab code, too. Also I just found a brand new paper on TurboPixels, called TurboPixel Segmentation Using Eigen-Images . Sounds interesting. I'll dig into it right now :)

Using vl_feat on 64-bit Linux with 32-bit Matlab

A lot of very good computer vision and machine learning libraries are written for use in Matlab. While Matlab has some advantages, I am more of a python man myself. I am a big fan of the vlfeat library by  Andrea Vedaldi and Brian Fulkerson. It is written for use in Matlab but there are some Python bindings provided by Mikael Rousson. Sadly they do not support all of vlfeat's great features. So today I wanted to make some more of vlfeat's functionality available in Python. For that, I first had to understand their Matlab interface. But when I tried to compile vlfeat I ran into some difficulties. The main problem is that the student version of Matlab is provided only in a 32bit version. But the Linux on my box is 64 bit. So here the journey begins. I am using Ubuntu but I guess the steps are quite similar for other distributions. First of all, you really have to convince mex to compile for 32bit. So in the Makefile under Linux-32 set MEX_FLAGS   ...