AMAT: Medial Axis Transform for Natural Images
Stavros Tsogkas, Sven Dickinson
In International Conference on Computer Vision (ICCV), 2017.
This code is released under the MIT License (refer to the LICENSE file for details).
- Linux OS (we used Ubuntu 16.04).
- A recent version of MATLAB. All our experiments were performed using MATLAB R2016a.
- spb-mil for medial point detection code.
- matlab-utils for various MATLAB utility functions.
- inpaint_nans for 2D image inpainting.
- L0Smoothing code for edge-preserving image smoothing.
Our (MATLAB-only) code runs at ~30-40sec for a 256x256 image on a modern desktop CPU. We are working on speeding it up.
Generally:
- All data should go under
data/
. - All external code should go under
external/
. amat
results, models etc should go underoutput/
.- Project-specific results and plots are saved in the respective directories of that project. E.g.:
- spb-mil trained models and medial point detection results are saved in
external/spb-mil/output/models/
. - medial points detection plots are saved in
external/spb-mil/output/plots/
.
- spb-mil trained models and medial point detection results are saved in
Feel free to change the paths in setPaths.m
and use symbolic links to change directory hierarchy to your preference.
- Clone the
amat
repository:git clone git@github.com:tsogkas/amat.git
The code comes with a startup.m
file that automatically sets up the directory structure and downloads the required packages and data.
Running startup
or starting MATLAB inside the amat
folder should be enough.
However, If you want to execute the individual steps included in startup.m
yourself, do the following:
- Create folders
output/
,external/
,data/
,output/models/
. - Clone my spb-mil repo:
git clone git@github.com:tsogkas/spb-mil.git
- Clone my matlab-utils repo:
git clone git@github.com:tsogkas/matlab-utils.git
- Download the L0Smoothing code and extract it in
external/
. - Download the inpaint_nans code and extract it in
external/
. - Download the BSDS500 dataset and benchmark code and extract it in
data/
.
NOTE: in some cases MATLAB websave
function might cause MATLAB to crash. If you face any such problems, please download and extract the BSDS dataset manually.
- Download the BMAX500 annotations.
BMAX500 is a MATLAB struct that contains annotations for the training, and validation subsets. Annotations for the test subset will be released in the future.
- Training the spb-MIL:
You can train the spb-MIL medial point detector on BSDS500, with the default options, with the following command:
trainMIL('trainSet',BMAX500.train);
- Medial point detection experiments:
You can evaluate the performance of the AMAT in medial point detection using the command:
model = testSPB('amat','testSet',BMAX500.val);
Performance statistics are contained in the model.BMAX500.val.stats
struct.
- Image reconstruction experiments:
You can evaluate the performance of the AMAT and baseline methods, using the command:
models = testReconstruction({'spbModelPath','gtseg','gtskel','amat'},'testSet',BMAX500.val);
Performance statistics are contained in the models{i}.BSDS500.val.stats
struct.
If you find our code or annotations useful for your research, please cite our paper AMAT: Medial Axis Transform for Natural Images:
@article{tsogkas2017amat,
Author = {Tsogkas, Stavros and Dickinson, Sven},
Title = {AMAT: Medial Axis Transform for Natural Images},
Journal = {ICCV},
Year = {2017}
}