Posts

Neural Network in Python with CUDA

My colleague Hannes uploaded a simple Multi Layer Perceptron as a demo for our CUV library. It is written entirely in Python and classifies the MNIST dataset of handwritten digits. He also wrote a blog post explaining the design and use in detail. The code is very easy to understand and to expand. But it is very fast - of course, using CUDA - and can serve as the basis for many experiments. There are also convolution routines in the library and its even possible to extend the network to a convolutional neural network entirely in Python and on the GPU.

CUV CUDA Library updated

The CUDA library from my working group was updated again today. Features of the library include matrix and vector operations on CPU and GPU using NVidia Cuda. Much work went into a clean design and ease of use. Beside the C++ interface there are also Python wrappers for very easy coding using the GPU. We mainly use this library for neural networks and restricted Boltzmann machines but it is quite generic and everybody who uses dense or diagonal matrix operations can benefit from it. New features include convenience functions in Python and Image Pyramids on the GPU. There are also some minor fixes. If everything goes as planned there will be another mayor update quite soon.

Python things you never need: Empty lambda functions

Ever wanted to create an empty Python function in-line? No? Me neither. But my coworker does... We found the answer: <pre> x = lambda : None </pre> If you ever needed this, please tell me ;) [Edit] Apparently some people do need it :) Btw, most people seem to try Most people try lambda: pass first. But you have to remember, the thing at the right side of the colon is the return value of the function, not the body! So an expression is needed, not a statement. [\Edit]

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 :)

Pascal VOC 2010 programm is online.

This years Pascal VOC workshop is over and on its website , you can find papers by the winning entries. They are really worth reading.

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   ...

MNIST for ever....

Image
[update] This post is a bit old, but many people still seem interested. So just a short update: Nowadays I would use Python and scikit-learn to do this. Here is an example of how to do cross-validation for SVMs in scikit-learn. Scikit-learn even downloads MNIST for you. [/update] MNIST is, for better or worse, one of the standard benchmarks for machine learning and is also widely used in then neural networks community as a toy vision problem. Just for the unlikely case that anyone is not familiar with it: It is a dataset of handwritten digits, 0-9, in black on white background. It looks something like this: There are 60000 training and 10000 test images, each 28x28 gray scale. There are roughly the same number of examples of each category in the test and training datasets. I used it in some papers myself even though there are some reasons why it is a little weird. Some not-so-obvious (or maybe they are) facts are: - The images actually contain a 20x20 patch of digi...