Binary Image Skeletonization Using 2-Stage U-Net

Mohamed A. Ghanem, Alaa A. AnaniarXiv 2021

Abstract

Skeletonization, the process of extracting a 1-pixel wide "backbone" from a binary shape, is a fundamental task in image analysis. Traditional deep learning models for skeletonization often fail due to extreme class imbalance and the over-sensitivity of standard evaluation metrics. This paper introduces a two-stage U-Net pipeline that separates skeleton generation from refinement. Additionally, the authors propose Matching Cross-correlation (M-CCORR), a new metric designed to better handle minor pixel translations that disproportionately penalize models under standard F1 scoring. Experimental results on the Pixel SkelNetOn dataset demonstrate that the two-stage approach significantly outperforms single-stage baselines.

Introduction

Skeletonization is vital for applications ranging from anatomical modeling to object matching. However, applying deep learning to this domain faces two primary challenges:

  1. Class Imbalance: Skeleton pixels typically represent a tiny fraction of the total image area, causing standard loss functions to favor background predictions.
  2. Metric Sensitivity: The standard F1 score is highly sensitive to minor spatial shifts. A visually accurate skeleton shifted by a single pixel can result in a near-zero F1 score, failing to reflect the model's topological success.
Illustration of the F1 score's sensitivity to minor shifts compared to the proposed M-CCORR metric.

Methodology: The Two-Stage U-Net

The researchers propose a modular approach using a modified U-Net architecture. Instead of attempting to produce a perfect 1-pixel skeleton in a single pass, the task is decomposed into two distinct stages:

  • Stage 1 (Skeletonizer): This network is trained to produce a "thick" or rough skeleton from the input binary image.
  • Stage 2 (Corrector): This network takes the output of Stage 1 and focuses on thinning and refining the structure into the final 1-pixel wide skeleton.
The proposed two-stage pipeline: Stage 1 generates a thick skeleton, which Stage 2 then refines into a corrected, thin skeleton.

The models are trained sequentially rather than end-to-end, which the authors found improved stability. To address class imbalance, a Weighted Categorical Cross-entropy (CCE) loss was used, weighting skeleton pixels 25 times more heavily than background pixels.

Evaluation and M-CCORR

To address the "brittleness" of the F1 score, the authors introduced Matching Cross-correlation (M-CCORR). This metric utilizes normalized correlation coefficients combined with a distance-based penalty. Unlike the F1 score, M-CCORR is "translation-aware," recognizing the quality of a skeleton even if it is slightly misaligned with the ground truth at the pixel level.

Results

The two-stage approach was evaluated on the Pixel SkelNetOn dataset (1,725 images). The results show a clear advantage for the multi-stage decomposition over a single-stage baseline.

Model F1 Score M-CCORR
One-Stage 0.4866 0.5604
Two-Stage 0.5968 0.6399
Three-Stage 0.5802 0.6271

Interestingly, adding a third stage (Three-Stage) led to a decrease in performance, suggesting that further stages may introduce noise or over-complicate the feature mapping rather than improving the thinning process.

Conclusion

By decomposing skeletonization into minimization and correction phases, the proposed two-stage U-Net effectively captures both global structure and fine details. The introduction of the M-CCORR metric provides a more nuanced evaluation framework for future research in this field. Future work will explore alternative loss functions and pre-processing techniques to further refine the thinning process.

Summary updated

BibTeX
@misc{ghanem2021binary,
  author = {Mohamed A. Ghanem and Alaa A. Anani},
  title = {{Binary Image Skeletonization Using 2-Stage U-Net}},
  year = {2021},
  eprint = {2112.11824},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.11824},
}
Figure