Software

Work

Here are a few programs directly related to my research.

The Synthetic Visual Reasoning Test

Don Geman and I developed a series of synthetic recognition tasks which require to go beyond local descriptors and simple statistics of the image to be solved properly.

The Folded Coarse-to-Fine Detector

This is a detection algorithm we have developed for cat detection and described in Fleuret & Geman 2008. You can get the source code and all the data on that page, or the source code alone with

git clone http://fleuret.org/git/folded-ctf/

The Probabilistic Occupancy Map

The Probabilistic Occupancy Map is an algorithm to estimate an approximation of the marginal posterior probabilities of presence of individuals at different locations of an area of interest, given the result of a background subtraction procedure in different views. The camera calibrations are indirectly provided through a family of rectangles which approximate the silhouettes of individuals located at the considered locations. You can download the source code from the web page of the CVLab at EPFL, or with

git clone http://fleuret.org/git/pom/

You can find more detailed information in the section V and Appendix A of Fleuret & al. 2008.

The CMIM learner

The Conditional Mutual Information Maximization is a feature-selection technique for two-class classification with binary features. It is extremely fast (a few tens of a second learning for typical tasks), and when combined with a naive Bayesian learner it is very robust to over-fitting. Error rates are similar to those obtained with state of the art methods such as SVM or boosting. More information can be found in Fleuret 2004.

You can download an implementation under the GPL v3.0 with

git clone http://fleuret.org/git/cmim/

To use it, just untar the archive file and execute test.sh. It will create a training and test sets for a toy problem, run the various classifiers and display the error rates.

data-tool

This is a small application to do very standard operations on data-sets, mainly as pre-processing for gnuplot. It can compute an histogram from a list of values, compute mean, variance, standard deviation, maximum and minimum values, compute the ROC curve or the ROC surface. This is not rocket science, but I use it often and it may be useful to others, too.

git clone http://fleuret.org/git/data-tool/

A multi-layer perceptron

I wrote, as a part of a larger project, a multi-layer perceptron in C++. On the MNIST data set, with the raw pixels in input, 200 hidden neurons, 10 output neurons with a winner-take-all rule and 40,000 examples for training, it achieves 3.42% error rate on the test set.

git clone http://fleuret.org/git/mlp/

Manipulate algebraic expressions in C++

This mapping class allows to manipulate formal expressions easily as if they were numerical values (i.e. operators and standard mathematical functions are defined).

git clone http://fleuret.org/git/mappings/

Unix tools

Here are a few application for Linux and other unices written in plain C.

You can install them easily by putting the source and compiling wherever you want, creating symbolic links in ${HOME}/local/bin/ and ${HOME}/local/man/man1/ to the executables and man-pages, and adding these directories to your $PATH and $MANPATH respectively.

Dynamic search in console

This command is a real-time interactive pattern matcher in console. It can be used to visit efficiently files in general, and shell history in particular. For the latter, contrary to what the readline C-r does, this application does not show only one entry at a time, but restricts in real time the display to all the entries matching the pattern. You can at any time select one, which will be injected in the input buffer of the current tty.

Its aims are somehow similar to those of dmenu, but it is a pure tty command that can be used in console.

git clone http://fleuret.org/git/selector/

It is general enough to be used with any shell, but was written for and tested with bash, and it has a short-cut option --bash, which is just equivalent to a bunch of other flags. So, you can use it by adding to your ~/.bashrc either an alias

alias h='selector --bash -f <(history)'

or a key-binding

bind '"\C-[r":"\C-a\C-kselector --bash -f <(history)\C-m"'

This specific setting will bind it to Alt-r. The man page explains in details how to do that.

This version has been tested on both Linux i386, Linux ARM, MacOS, and FreeBSD 8.0 (the -v option is broken on the latter, since TIOCSTI is).

Size-sorting files and directories

The dus command computes the size of files and directories recursively and displays them sorted accordingly.

git clone http://fleuret.org/git/dus/

It compiles and works on Linux i386, Linux ARM, and FreeBSD 8.0.

Find files common to different directories

The finddup command can find duplicated files in a given directory, files from one directory which exist also in another one, or files which exist in a directory and not in another one. It scan directories recursively, ignore symlinks and compares file sizes before checking their contents.

git clone http://fleuret.org/git/finddup/

It compiles and works on Linux i386, Linux ARM, and FreeBSD 8.0.

Fan speed control daemon

This is a very simple daemon to control the fan speed. I have been using it on my X61s since December 2008 without problem. However, there are no reported extensive test on another machine, so please use with care.

git clone http://fleuret.org/git/breezed/

A patched version of xapm for ACPI

The simplest tool to monitor the battery status under X-Window has been for a long time xapm, included on Debian in the apmd package. Unfortunately, it is not ACPI compliant, and all the alternatives either require some 200Mb GUI libraries à la KDE, or are loaded with bells and whistles and lack the simplicity of xapm. So, here is a patched version which at least works on my Thinkpad T41p.

git clone http://fleuret.org/git/xacpi/

It can display the battery remaining time (either for complete discharge or complete charge, depending on the current state), a colored bar indicating the charge, the CPU temperature (in Celsius or Fahrenheit, in red when higher than a fixed maximum), the CPU frequency, and the date and time. All this information is optional and can be or not displayed. You can check this impressive screenshot with all options activated (note that usually one removes the window frame in the window-manager.)

I run it at the bottom of my screen with the following in my .xsession:

xacpi -criticaltemperature 65 -dateformat "%k:%M %a %e %b" \
      -showdate -showbar -showtemp -showcpufreq -percentauto -delay 15 \
      -geometry 320x14+0+1034 &

Remarks and bug reports – especially related to the compliance with other laptops – are welcome.

Emacs scripts

Here are some of the numerous scripts I wrote over the years for Emacs.

git clone http://fleuret.org/git/elisp/

In particular, you will get my heavy fleuret.emacs.el and fleuret.vm.

An alarm if the current file is not under vc

The function defined in alarm-vc.el checks if the file loaded in the current buffer is under cvs, subversion or git and adds an alarm in the modeline if it is not while some files in the directory are. You just need to load the source file to activate the thing.

A dynamic string-selector

The function selector/select in selector.el is a dynamic regexp-matching interface. While you type, the buffer dynamically refreshes its content to show only the strings matching the regexp you have typed so far. It is very useful for instance to find files among those recently opened. You just have to add to your ~/.emacs.el

(require 'recentf)
(recentf-mode 1)

(when (load "selector" t t)
  (define-key global-map [(control x) (control r)] 'selector/quick-pick-recent)
  (define-key global-map [(control c) (control s)] 'selector/quick-move-in-buffer)
  (define-key global-map [(control x) (control b)] 'selector/switch-buffer)
)

Lookup words in the dictionary

If you often write things in English and need to lookup words, the lookup-dict.el command can be handy. It calls the unix dict command with either the content of the selected region or the word at point and displays the result in a new buffer. Just add

(load "lookup-dict.el")
(define-key global-map [(control \?)] 'lookup-dict)

in your ~/.emacs.el to associate that command to the C-? key.

Use mplayer under emacs

Since I am an intensive Emacs user, I wrote this major mode front-end to mplayer to avoid all those fancy GUIs young kids love those days. It displays your list of mp3 and web radios in a buffer and allows you both to control mplayer and organize sequences to play. You can check this impressive screenshot.

I have the following in my ~/.emacs.el:

(when (load "media.el" nil t)

  (setq media/expert t
        media/history-size 1000
        media/playlist-file "~/private/media-playlists"
        media/mplayer-args '("-softvol" "-framedrop")
        media/url-list '("~/mp3"
                         ("http://72.20.6.90:8156/listen.pls" . "bsp.org")
                         ("http://www.radioswissjazz.ch/live/mp3.m3u" . "Swiss Jazz")
                         ))

  (define-key global-map [(meta \\)] 'media)
)

Press `?' to get a very short help, or look for the media/* in the biding list given by C-h b.

Handle rendez-vous and alarms

To remember rendez-vous, dead-lines and important things in general I wrote enotes.el, which can store notes, each associated to a date and a warning time. An alert pops up at the warning time, and a new warning time is automatically set. The whole stuff is simple and light to use. Here is a screenshot. Read the comments in the source to see how to use it.

I have the following in my ~/.emacs.el:

(when (load "enotes" nil t)
  (setq enotes/file "~/private/enotes")
  (enotes/init)
  (define-key global-map [(control x) (control n)] 'enotes/show-all-notes))

Shell scripts

Here are my various handy shell scripts. Some were written ages ago are not relevant anymore.

Control a DNS-323 from the command line

The DNS-323 is a cheap NAS under Linux. After some Googling, I could not find a simple recipe to shut it down from the command line. Hence here is a short script called dns323-op.sh to get the current status (temperature, RAID, etc.), restart it or shut it down. Use the -h flag to get the (concise) help.

Kill all useless xterms

Here is a short bash script kill-unused-xterms.sh to kill all open xterms which have only one bash as children and nothing else.

Make a web page from images

This script picstohtml.sh generates a html file from the images contained in a directory. It generates the thumbnails with the imagemagick tools.

A web server written in bash

I always thought that a simple web server could be handy to keep an eye on experiments running, for instance by allowing to parse logs and generate graphs. So here is the Bash Web Server. The source code is only ~70 lines long and not too atrocious. You can get an example of a gnuplot-based CGI for test.

In any case, do not use it as a public web server since it obviously is unreliable, inefficient and insecure.

Update a dynamic IP on dyndns

If your computer's IP changes often, you can get a hostname with dyndns.com. With this update-netopia-dyndns.sh, script, you can update your IP on DYNDNS seamlessly, even if the visible IP is a VPN one or a netopia DSL modem one. The script takes first the IP given in argument, or the IP of the first interface up tun0, ath0 and eth0, or the netopia modem's IP. Note that if an interface is up but matches 192.168.*.*, it will be ignored. To run it on a regular basis (for instance every 10 minutes), just add something like

3,13,23,33,43,53 * * * * root /usr/local/bin/update-netopia-dyndns.sh

in your /etc/crontab.

Configuration files

A good configuration file can make the difference between a UNIX application barely usable and perfect. See above for Emacs related stuff.

bashrc

This fleuret.bashrc for bash mainly sets the window title according to the current working directory, and do a few others things.

fvwm2rc

A fleuret.fvwm2rc for the FVWM2 window manager. It sets a very (I mean it) simple look to fvwm2 by removing the window borders and the relief effects in the bars. It also sets various shortcuts to move the windows around. I removed all things too specific to my configuration.

Older stuff

These are things I wrote in my young age, which means in the 1990s. Wrote last century on computers and in languages nobody remembers.

A crosswords applet in Java (1998)

This applet is an interactive cross-words grid for web pages. Its source code Words.java is under the GPL 3.0.

Go to the crossword applet

To use it, first get the file crosswords.zip and uncompress it in your public_html directory or equivalent (directory that contains your public files). You will obtain three class files (Words.class, Grid.class and Square.class). Then, you have to add an <applet> tag and the appropriate <param> in your HTML file.

Distort and smooth (1996)

The distort program corrects the "fish-eye" effect of the QuickCam. If you already tried to take pictures of scenes with lines, or just close-up portraits, you must have seen how the QuickCam distorts the image. For example, a homogeneous gride will be deformed like the top-row pictures.

To handle this, I wrote a small soft that distorts the image in such a way that the gride shown above gets back its homogeneous aspect. This soft is called distort and, given the a list of a distorted gride intersection coordinates, it distorts a picture to straight it out. Here are two examples of pictures before and after a correction.

The second program is supposed to help you improve the shade of gray. Maybe have you noticed that when you zoom on a quickcam picture, you can see a terrible pixel noise such as on the left picture. One can see on such picture two problems: First there is a random noise on the grey-scale levels, which can be corrected with a simple averaging on a few pictures. Second, there is a more structured noise. No idea if this phenomenon is standard on all QuickCam or not, but as you can see on this detail, odd columns are ligther than even ones. The program I propose here, called smooth, can perform both corrections. The picture on the right is an example of what can be done, using 32 pictures to compute the averaging, and using for reference picture a picture of a white wall, also smoothed with 32 pictures.

You can download both distort and smooth and the files they need in distort.tgz.

The Tiny Tracer (1992)

As all people doing computer-science, I made a ray-tracer when I was young (as Frédo did). It was written in Modula-2, on an Amiga 500, and it was very slow. The objects were described as intersections of quadrics, and there wasn't any optimization. I put here some images it calculated, and the possibility to download the source file petitracer.tgz. You can also have a look at a few images it generated.

The turmites (1989)

A turmite is a kind of 2D Turing machine. It has an internal state, and at each step, depending of its internal state and the color of the cell it is on, it puts a new color in the cell, moves in one direction (ahead, right, left), and picks a new internal state. I took the idea in the French version of "Scientific American", and I made a program on Amiga to simulate a bunch of them, with some reproduction and mutation rules.

You can download the source and the binary files, you can look at a turmite written in Java below, or just look at what it looks like.

You can also have a look at an applet showing a living turmite. The parameters its behavior depends on are randomly generated, and you can modify them by clicking on the array; the Clear button clear the screen and the Random button generates a new random turmite.

Go to the turmite applet