# TTH-Net: Two-Stage Transformer-CNN Hybrid Network for Leaf Vein Segmentation
## 1 Introduction  
Leaf vein segmentation plays a crucial role in the fields of botany and biology due to the important physiological functions and unique morphological characteristics of leaf veins. By segmenting leaf vein patterns, it can further enhance the accuracy of plant species classification [1], facilitate the development of smart agriculture [2], and contribute to research on climate condition analysis [3]. Similar to the vascular network in human beings, leaf vein patterns exhibit complex distributions and strong connectivity. Thicker veins are responsible for providing support to the leaf, running through the entire leaf, while thinner veins are responsible for nutrient transport, hence exhibiting strong connectivity. There are close connections and numerous loops between them, which pose significant challenges for extraction and segmentation tasks. To segment leaf vein patterns, early works mainly rely on chemical reagents [4] and scanners [5] to extract veins. [PERSON] et al. [4] used a chemical method where the leaf tissue was cleaned, leaving behind the vein pattern. [PERSON] et al. [5] utilized the scanner to obtain high-resolution leaf images, and then extracted the vein pattern via unconstrained hit-or-miss transforms and adaptive thresholds. Limited by image processing techniques, extraction steps are time consuming, and the results are difficult to reproduce. To enhance the automation level of leaf vein extraction, [PERSON] et al. [6] designed the LEAF GUI software specifically for vein extraction. This software captures leaf images and returns statistical data about the vein network and stomatal structures via a series of interactive thresholding and cleaning steps, which further deepens users' understanding of leaf vein networks. With the development of image processing techniques, more and more machine learning-based algorithms have been employed for leaf vein segmentation. [PERSON] et al. [7] used the angle between the main vein and secondary veins and the centroid vein angle as key parameters, combined with Hough lines, to extract the leaf veins. [PERSON] et al. [8] utilized the canny edge detection algorithm to determine the nutritional status of plants by detecting the leaf edges and veins. The Scale Invariant Feature Transform (SIFT) operation in [9] was used to extract local features from leaf vein images. These features are considered important references for subsequent plant classification. Compared to the methods based on chemical reagents and scanners, machine learning-based algorithms rely on manually crafted feature extractors and have limited automation levels. With the remarkable performance of the FCN network in the field of segmentation, a lot of CNN-based deep learning algorithms [10; 11; 12; 13] have been extended to the domain of image segmentation. [PERSON] et al. [14] employed existing CNN models to extract leaf veins and achieved impressive performance. Convolutional Neural Networks (CNNs) utilize small convolutional kernels that slide over the image to capture local information and gradually build receptive fields. By stacking multiple convolutional layers, CNNs can aggregate and learn hierarchical representations, enabling them to capture both low-level and high-level features from the input image. However, due to the limitation of the receptive field, the continuity of the veins may be compromised. To address the aforementioned issues, inspired by the recent success of Transformers in natural language processing (NLP), this paper leverages Transformers to enhance the accuracy of vein extraction. The core of the Transformer is the self-attention module. By extracting pixel relationships across the entire image, attention coefficients based on global receptive fields can be obtained. Multiplying this probability map with the original image via matrix multiplication significantly enhances the global dependency in the feature maps. Recently, related studies [15; 16; 17] have already demonstrated the advantage of Transformers over CNNs in modeling global context.