Interfacing the INRIA Object Detection and Localization Toolkit with LabelMe data

by Jenny Yuen

Here you will find code to link the INRIA Object Detection and Localization Toolkit with data in LabelMe.

a. Contents

  1. Downloading and installing the code.
  2. Downloading the LabelMe pictures.
  3. Running the OLT on LabelMe pictures.
  4. Results

b. Downloading and installing the code.

Download the OLT and the LabelMe Matlab toolbox and follow their respective installation instructions.

Download the scripts to interface between LabelMe and the OLT here.

I have created the following scripts that call functions in the LabelMe toolbox. Click here to download them. Unzip them and add the path to its directory to your Matlab path:

>> LABELMEDOWNLOADERPATH=fullfile(<downloadPath>, 'LMOLTInterfacer', 'LabelMeDownloader')

>> addpath(LABELMEDOWNLOADERPATH);

where <downloadPath> is the folder to where you unzipped the package.

c. Downloading the LabelMe images.

In Matlab, run downloadObject.m to start downloading the LabelMe images to your local machine. You will have to edit some of the variables in this file to adapt the script to your machine:

The structure of the folders is as follows for each object class. For example, if we had car as a class:

car_full contains images labeled with cars, car_cropped contains crops of the cars in the images in car_full; finally, car_neg contains images that haven't been labeled as containing cars.

d. Running the OLT on LabelMe pictures.

    Go to the OLTRunner folder in a unix console. Add the OLTRunner subfolder in your $PATH variable.

    >> export PATH=$PATH:<downloadPath>/LMOLTInterfacer/OLTRunner

  1. Create the lists with the positive and negative examples for the training. All the images in the positive examples have to have the same size. The images created in the _cropped folder have been resized to fullfill this requirement.

    > cd car/train; ls car_cropped/*.jpg> pos.lst

    > cd car/train; ls car_neg/*.jpg> neg.lst

  2. In the LabelMeImages folder, run: >createobjectdetector.sh [object dir] [out model folder] [width] [height]

    For example:
    > createobjectdetector.sh car/train car_hog 87 55

  3. Run the classifier on images in the test data set.

    > runonimage.sh [image name/image directory/list file] [out text file] [out image file/out image dir] [model path] [width] [height] [thresh]

    > runonimage.sh car/test/car_full_test.lst car_out.txt car/test/car_full_test car_hog 87 55 12

    The [image name/image directory/list file] is the image name, directory, or list file of the test image(s). [out text file] is the file name that will contain results from the classification, [model path] should be one of the _hog folders created in the previous steps containing the model. The [width] and [height] values are the same ones as in the previous command and finally the threshold can be adjusted to increase the precision.

e. Results on LabelMe data.

  1. Car
  2. Bike
  3. Bottle
  4. Couch