Software

Work · GNU/Linux · GNU/Emacs · Config · Shell · Old stuff

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.

Here is the source code under the GPL v3.0: svrt.tgz.

It should compile and run on any reasonably configured GNU/Linux machine. You can test it by invoking the doit.sh script, which will run through the 13 problems we made public. For each it will save 100 images of each class, train a Boosted classifier with 1000 weak-learners and test it. Please read the README.txt file for more information.

The Folded Coarse-to-Fine Detector

This is a detection algorithm we have developped 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 from the git repository with

git clone http://www.idiap.ch/~fleuret/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://www.idiap.ch/~fleuret/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 overfitting. 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, as an archive file cmim-1.1.tgz or with

git clone http://www.idiap.ch/~fleuret/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

The data-tool command 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. You can get the files from the repository with

git clone http://www.idiap.ch/~fleuret/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. Here is the archive file mlp-mnist.tgz. You can also get it from the git repository with

git clone http://www.idiap.ch/~fleuret/git/mlp-mnist/

A mapping class to manipulate algebraic expressions

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

For instance, the following program is valid.

int main(int argc, char **argv) {
  // X will be the "identity mapping"
  Mapping X = Mapping::X;
  // A undefined mapping
  Mapping f;
  // Now contains some complex stuff
  f = sin(X * X - (X * 3.0) + 0.5);
  // Display it
  cout << f*f << endl;
  // fp will be the first derivative
  Mapping fp = f.derivative();
  // fs the second derivative
  Mapping fs = fp.derivative();
  // Compute the second derivative at 5
  cout << fs(5.0) << endl;
  return 0;
}

and it prints

( sin( ( ( ( X ) * ( X ) ) + ( ( -1 ) * ( ( X ) * ( 3 ) ) ) ) + ( 0.5 ) ) ) *
 ( sin( ( ( ( X ) * ( X ) ) + ( ( -1 ) * ( ( X ) * ( 3 ) ) ) ) + ( 0.5 ) ) )
42.154

You can get it from the git repository with

git clone http://www.idiap.ch/~fleuret/git/mappings/

GNU/Linux

Small applications mainly for GNU/Linux.

A command line dynamic search

The selector command is a real-time pattern matching, and can be used to visit your shell history efficiently. 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.

You can either download an archive selector.tgz, or get the code from the git repository with

git clone http://www.idiap.ch/~fleuret/git/selector/

You can install it with make install (it will copy a binary in /usr/bin/ and a man page in /usr/share/man/man1/), and you can use it by adding to your ~/.bashrc either an alias

alias h='selector -d -i -b -v -w -f <(history)'

or a key-binding

bind '"\C-[r":"\C-a\C-kselector -d -i -b -v -w -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 and MacOS, and I even made an attempt at creating a Debian package selector_1.0-R156_i386.deb. Please let me know how buggy it is.

A daemon to control the fan speed

This simple daemon breezed.tgz controls the speed of the fan. I tested it only on my X61s. Please use it with care. You can also get the code with

git clone http://www.idiap.ch/~fleuret/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: xacpi-1.3.tgz. You can also get the code with

git clone http://www.idiap.ch/~fleuret/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 those informations are 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.

GNU/Emacs scripts

GNU/Emacs is more than an editor. One can do almost any computer-related tasks with it: mail reading, newsgroup reading, web surfing, schedule management, etc. You can get my heavy fleuret.emacs.el and fleuret.vm.

An alarm if the current file is not under vc

This short routine 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)
)

A command to lookup in the dictionary

If you often write things in English and need to lookup words, this command lookup-dict.el 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.

A major mode to use mplayer under emacs

Since I am an intensive GNU/Emacs user, I wrote this major mode front-end to mplayer to avoid all those fancy GUIs young kids love those days. You can get the source here: media.tgz. It displays your list of mp3 or and web streamings 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/duration-to-history 30
        media/history-size 1000
        media/playlist-file "~/private/media-playlists"
        media/mplayer-args '("-softvol" "-framedrop")
        media/url-list '("~/mp3"
                         ("http://viphttp.yacast.fr/V4/player_radiofrance/finter.asx" . "France Inter")
                         ("http://viphttp.yacast.net/V4/radiofrance/franceculture_hd.m3u" . "France Culture")
                         ("http://viphttp.yacast.net/V4/radiofrance/francemusique_hd.m3u" . "France Musique")
                         ("http://www.technomusic.com/live/hi/pls" . "Technomusic.com")
                         ("http://www.fullhouseradio.com/listen.pls" . "Full House Radio (fullhouseradio.com)")
                         ("mms://live.france24.com/france24_fr.wsx" . "France 24")
                         ))

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

The main commands are:

A GNU/Emacs program to handle rendez-vous and alarms

To remember rendez-vous, dead-lines and important things in general I wrote this short program enotes.el. With it, you 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))

Configuration files

A good configuration file can make the difference between a UNIX application barely usable and perfect.

GNU/Emacs

I have written several functions and configuration hacks for GNU/Emacs and vm. You can have a look at my fleuret.emacs.el and fleuret.vm.

Bash

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

Fvwm2

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.

Shell

Here are my various handy shell scripts. Some were written ages ago are not relevant anymore. You can get my fleuret.bashrc too.

A script to 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.

A script to 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.

To download new pictures from a digital camera on USB

By just invoking this script called getpics.sh, you can download new pictures (i.e. the ones not already-downloaded) from a digital camera hooked on the USB port. This script keeps a list of the pictures it has downloaded (by defaults into ~/.getpics_list) so that it knows every time which pictures are the new ones, and uses gphoto2 to deal with the camera. You can check my Ixus V2 installation page to see how you can set automatically the usb device as usable by non-root users.

Here is the result of getpics.sh --help

getpics.sh [--help] [--all] [--archivedir <dirname>] [--listfile <filename>]

Downloads all pictures not already downloaded from the currently hooked camera
to an archive directory.

Written and (C) François Fleuret 2004, under the GPL.
Contact <francois.fleuret@epfl.ch> for comments.

--all forces the download of all pictures, including those already downloaded
--archivedir specifies where to save the pictures
--listfile specifies where to save the list of downloaded pictures

The environment variable $GP_ARCHIVE_DIR specifies where to store the pictures
and $GP_LIST_DOWNLOADS where to store the downloaded picture names.

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

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

A crosswords applet in Java (1998)

This applet is an interactive cross-words grid for web pages. The source code is kind of open-source (modified GPL licence). Basically you can use it on non-profit sites, and you can modify it and distribute it as long as you keep the same licence.

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 (it's why it was so slow). 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