sunsmarterjie / SDL-Skeleton

A toolbox for object skeleton detection, can also be used for edge detection, building extraction and road extraction. TIP (2021)
126 stars 27 forks source link

SDL-Skeleton

Our paper has been accepted by TIP(2021)

Attention:evaluation code is newly updated here, password is x9bd. In addition, many guys want the pretrained model, which is missed during the machine clearing. I will re-run AdaLSN and share the pretrained model. I re-run the AdaLSN, and the pre-trained is released here, password: abcd.

SDL-Skeleton is a FREE toolbox for object skeleton detection, which also has strong adaptability to general pixel-wise binary classification tasks, such as edge detection, saliency detection, line detetection, building extraction and road extraction. This code is based on the implementation of HED and SRN.

SDL-Skeleton includes popular skeleton detection methods, including HED1, SRN2, HiFi3, DeepFlux4 and our newly proposed Ada-LSN5. Ada-LSN achieved the state-of-the-art results across all skeleton dataset, for example, we achieved 0.786 performace on sklarge dataset.

skeleton

Figure 1: Skeleton detection examples.

edge

Figure 2: Edge detection examples.

building

Figure 3: Building extraction examples.

road

Figure 4: Road extraction examples.

Requirements

Pretrained models

Datasets

Skeleton Detection

Five commonly used skeleton datasets are used, including sklargesk506sympascalsymmax and whsymmax. You also can download all these datasets at here, password:x9bd and revaluation code at here, password:zyqn.

The preliminary data augmentation code can be downloaded at sklarge, including resizing images to 3 scales (0.8x, 1.0x, and 1.2x), rotating for 4 directions (0◦, 90◦, 180◦,and 270◦), flipping in 2 orientations (left-to-right and up-to-down). After that, you can use resolution normalization technology (dataRN.py), which helps for skeleton detection because of their different image size.

Other tasks

We also test our methods on edge detection, building extraction and road extraction.

Usages

Skeleton Detection

You should first prepare your dataset -- download sklarge (or others) dataset and then augment them using the accompanying script. Next, if you want better performance, run dataRN.py.

Test HED and SRN by run:

python train.py --network 'hed'            # HED
python train.py --network 'srn'            # SRN
python train.py --network 'deep_flux'      # DeepFlux

At the same time, modify the saved path of the network model in engines/trainer.py. If you want to test DeepFlux, you also need to modify the data loader to use datasets/sklarge_flux.py. As for HiFi, we only implemented the network structure, with lacking the multi-scale annotation datasets.

Test Ada-LSN by run:

python train_AdaLSN.py
Our Ada-LSN supports different backbones, including VGG, ResNet, Res2Net and Inception. Simply modify the Ada_LSN/model.py to switch between different backbones. The performance of these different backbones on the sklarge dataset is as follows: backbones VGG ResNet50 Res2Net InceptionV3
F-score 0.763 0.764 0.768 0.786

Other tasks

Our Ada-LSN also can be used for other pixel-wise binary classification tasks. We archieved state-of-the-art performace in edge detection and road extraction. We think Ada-LSN is also suitable for other tasks, for example, in subsequent experiments, we found Ada-LSN also works well on building extraction. You can use our method to simply modify the data path and run:

python train_AdaLSN.py

Please refer to ODN6 for saliency detection and earthquake detection

Citation

@article{liu2021adaptive,
  title={Adaptive linear span network for object skeleton detection},
  author={Liu, Chang and Tian, Yunjie and Chen, Zhiwen and Jiao, Jianbin and Ye, Qixiang},
  journal={IEEE Transactions on Image Processing},
  volume={30},
  pages={5096--5108},
  year={2021},
  publisher={IEEE}
}