Home

Awesome

spb-mil

Use Multiple Instance Learning (MIL) to train a binary classifier of local symmetries on images from the Berkeley Segmentation Dataset (BSDS300).

Learning-Based Symmetry Detection for Natural Images
Stavros Tsogkas, Iasonas Kokkinos
In ECCV, 2012.

License

This code is released under the MIT License (refer to the LICENSE file for details).

Contents

  1. Requirements: software
  2. Requirements: hardware
  3. Directory structure
  4. Setup
  5. Using the code
  6. Citation
  7. References

Requirements: software

Requirements: hardware

You can run our code in any modern computer (desktop or laptop). spbMIL runs at ~15sec for a 481x321 image on a modern desktop CPU.

Directory structure

Generally:

Feel free to change the paths in setPaths.m and use symbolic links to change directory hierarchy to your preference.

Setup

  1. Clone the spb-mil repository: git clone git@github.com:tsogkas/spb-mil.git and add cpp, external and util to your working path.
  2. Clone the matlab-utils repository: git clone git@github.com:tsogkas/matlab-utils.git and add it to your working path.
  3. Create folders output/, data/.
  4. Download the BSDS300 images and human annotations and add them in data/BSDS300. If you want to use the newer version of the dataset, you can download the BSDS500 dataset and benchmark code and extract it in data/.
  5. Download the SYMMAX300 dataset.

NOTE: Please edit the setPaths function accordingly so that the paths reflect your directory structure.

Using the code

Training

You can train our MIL-detector using the trainMIL function. For example, to train a model on the train set of BSDS, using color and texture features, with 1000 training samples per image, use:

trainMIL('trainSet','train','featureSet','color','nSamplesPerImage',1000);

Testing

You can run performance evaluation tests on the val subset using the command:

model = testSPB('modelPath', 'dataset','SYMMAX300', 'testSet','val');

Performance statistics are contained in the model.SYMMAX300.val.stats struct.

Running the detector on an input image

img = imread('101087.jpg');
spb = spbMIL(img);

For more details, take a look at the spbDemo.

NOTE: Spectral feature extraction is time consuming. That is why we prefered to store the extracted features for the desired images and load them when necessary.

Citation

If you find our code or annotations useful for your research, please cite our paper Learning-Based Symmetry Detection for Natural Images:

@inproceedings{tsogkas2012learning,
	title={Learning-based symmetry detection in natural images},
	author={Tsogkas, Stavros and Kokkinos, Iasonas},
	booktitle={European Conference on Computer Vision},
	pages={41--54},
	year={2012},
	organization={Springer}
}

References