# Texts as Lines: Text Detection with Weak Supervision

Authors: Weijia Wu; Jici Xing; Cheng Yang; Yuxing Wang; Hong Zhou
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

Scene text detection methods based on deep learning have recently shown remarkable improvement. Most text detection methods train deep convolutional neural networks with full masks requiring pixel accuracy for good quality training. Normally, a skilled engineer needs to drag tens of points to create a full mask for the curved text. Therefore, data labelling based on full masks is time consuming and laborious, particularly for curved texts. To reduce the labelling cost, a weakly supervised method is first proposed in this paper. Unlike the other detectors (e.g., PSENet or TextSnake) that use full masks, our method only needs coarse masks for training. More specifically, the coarse mask for one text instance is a line across the text region in our method. Compared with full mask labelling, data labelling using the proposed method could save labelling time while losing much annotation information. In this context, a network pretrained on synthetic data with full masks is used to enhance the coarse masks in a real image. Finally, the enhanced masks are fed back to train our network. Analysis of experiments performed using the model shows that the performance of our method is close to that of the fully supervised methods on ICDAR2015, CTW1500, Total-Text, and MSRA-TD5000.


---

## Body

## 1. Introduction

At present, natural scene text detection has attracted more attention due to its practical application requirements, such as scene understanding, visual question answering, autonomous driving, text detection [1], and recognition [2, 3]. Text is one of the most fundamental semantics appearing everywhere in daily life, for example, in traffic signs, commodity packages, and advertising posters. These text instances in the real world have varying sizes, random directions, and arbitrary shapes, making them extremely challenging to label and capture accurately. Unlike other general objectives, scene text usually cannot be described accurately by the axis-aligned rectangle, and most detectors using an axis-aligned rectangle only have an F-measure of below 65%, such as TextSnake [4]. Recently, most scene text detectors based on deep learning have tended to detect texts in different shapes with many coordinates for better performance. However, the above detectors require accurate pixel-level labels with expensive costs. The labelling consumes a large amount of manpower and financial resources, especially for texts with arbitrary shapes in complex environments.The precision of text detection has a close connection with the labelling methods of datasets. For example, several common datasets, ICDAR2013 [5], ICDAR2015 [6], ICDAR2017 [7], Total-Text [8], CTW1500 [9], and MSRA-TD500 [10], have different labelling methods for various texts. ICDAR2013, as one of the common datasets, was introduced during the ICDAR Robust Reading Competition in 2013 and mainly includes horizontal bounding boxes made by two points at the word level. Because of this labelling peculiarity, text detectors [11, 12] using box regression have a great performance on ICDAR2013. ICDAR2015 was released in the ICDAR2015 Robust Reading Competition for multioriented text detection, using quadrilateral boxes as the annotations, as shown in Figure 1(b). EAST [13] and SPCNet [14], as the representatives of detectors, achieved good results on ICDAR2015. ICDAR2017 was a dataset with texts in nine languages for multilingual scene text detection, using quadrilateral boxes as the annotations as well as ICDAR2015. MSRA-TD500 was released in 2012, and the annotation method is the same as that of ICDAR2015. Unlike the above datasets, Total-Text and CTW1500 contain many curved texts, which aim to solve the arbitrarily shaped text detection problem. CTW1500 has more than 10k text annotations and at least one curved text per image. Total-Text contains many curved and multioriented texts, which require tens of points for accurate labelling. Recently, segmentation-based text detectors [4, 15, 16] have shown promising performance in existing datasets with high-cost labelling. The annotation design becomes more complicated to fit the requirements of text detection in the real world, and the cost also increases.Figure 1
Labelling methods. (a) Original image. (b) Bounding box labelling containing a considerable amount of background noise and interference from other text areas. (c) Visualization of segmentation annotation, requiring high labour cost. (d) Proposed annotation methods: coloured regions represent the labelled region, including the grey background and other coloured text lines.
(a)(b)(c)(d)The bounding box-based labelling method has low labelling costs but cannot fit text instances accurately in the wild, as shown in Figure1(b). The pixel-based labelling method matches texts with arbitrary shapes in a complex environment but requires high labelling costs, as shown in Figure 1(c). To mitigate this conflict, we explore detecting texts at the pixel level but with a low labelling cost. Precise drawings of the text region are difficult, but using a cross-line to locate text is simple. Therefore, we seek to simplify the complex text labelling as a line named the text line in this work. Compared with the box or full masks, this annotation is extremely simple and contains less pixel information, as shown in Figure 1. Hence, the following two difficulties must be considered:(i)
A weak text line label loses the text edge information and nearly all of the background information, which is rather problematic for supervised training(ii)
The loss function focuses only on the labelled area and is not sensitive to the unlabelled ground truthTo solve the above difficulties, a scene text detector based on weakly supervised learning is proposed in our paper. The model is first pretrained on SynthText to make it sensitive to the text region. Subsequently, in the training process of real data, the pretrained model is used to enhance the text line label. In addition, to enhance the weak label better, a soft label∈ [0, 1] containing pixel location (distance) information is used. The contributions of this work are summarized as follows:(i)
We first propose a scene text detector based on weakly supervised learning that significantly simplifies the annotation process without losing much precision.(ii)
A modified crossentropy loss function nameddegree crossentropy is proposed. The loss function can optimize the soft label containing distance information.


## 2. Related Work

Scene text detection has received significant attention over the past few years, and numerous deep learning-based methods [17–21] have achieved great progress. Increasing detectors tend to capture texts at the pixel level to detect texts more precisely.


### 2.1. Bounding Box-Level Text Detection Methods

Bounding box regression-based methods [19, 22] are inspired by general object detection methods such as SSD [23] and Faster R-CNN [24]. TextBoxes++ [25] further regresses to quadrangles instead of horizontal bounding boxes for multioriented text detection. RRD [26] uses rotation-invariant and sensitive features from two separate branches for better long text detection. DSRN [2] maps multiscale convolution features onto a scale invariant space and obtains uniform activation of multisize text instances for detecting texts. Although regression-based methods have achieved state-of-the-art performance, it is still difficult to capture all text information in a bounding box without involving a large proportion of background and even other text instances.


### 2.2. Pixel-Level Text Detection Methods

Pixel-level text detectors draw inspirations from FCN [23] and Mask R-CNN [27]. Using the mask as the annotation, PixelLink [28] performs text/nontext and links prediction at the pixel level. TextSnake [4] learns to predict local attributes, including the text centre line, text region, radius, and orientation, achieving improvements of up to 20% accuracy on curved benchmarks. CRAFT [15] trains a convolutional neural network producing the character region score and affinity score. PSENet [16] projects the feature map into several branches to produce multiple segmentation maps. TextField [29] detects scene text by predicting a direction field pointing away from the nearest text boundary to each text point. Text mountain [30] predicts text centre-border probability and text centre-direction to detect the scene text. Text detectors based on instance segmentation perform better with higher precision annotation.


### 2.3. Weak Supervision Semantic Segmentation

Sun et al. [31] leveraged the power of deep semantic segmentation CNNs while avoiding requiring expensive annotations for training. Rtfnet [32] took advantage of thermal images and fused both the RGB and thermal information in a novel deep neural network. Tang et al. [33] proposed a normalized cut loss for semisupervised learning; the loss combines partial crossentropy on labelled pixels and normalized cut for unlabelled pixels. Wang et al. [1] proposed a self-supervised approach and developed a pipeline to label drivable areas and road anomalies using RGB-D images automatically.


### 2.4. Weak Supervision Text Detection Methods

WeText [34] trains scene text detection models on a small number of character-level annotated text images, followed by boosting the performance with a much larger number of weakly annotated images at the word/text line level. WordSup [35] trains a character detector by exploiting word annotations in rich large-scale real scene text datasets.Recently, all detectors have been trained with fully annotated masks, requiring pixel-level accuracy for good quality prediction. Motivated by weakly supervised semantic segmentation [34, 36–38], we propose a weakly supervised scene text detector to alleviate the labelling consumption without losing high precision.


## 2.1. Bounding Box-Level Text Detection Methods

Bounding box regression-based methods [19, 22] are inspired by general object detection methods such as SSD [23] and Faster R-CNN [24]. TextBoxes++ [25] further regresses to quadrangles instead of horizontal bounding boxes for multioriented text detection. RRD [26] uses rotation-invariant and sensitive features from two separate branches for better long text detection. DSRN [2] maps multiscale convolution features onto a scale invariant space and obtains uniform activation of multisize text instances for detecting texts. Although regression-based methods have achieved state-of-the-art performance, it is still difficult to capture all text information in a bounding box without involving a large proportion of background and even other text instances.


## 2.2. Pixel-Level Text Detection Methods

Pixel-level text detectors draw inspirations from FCN [23] and Mask R-CNN [27]. Using the mask as the annotation, PixelLink [28] performs text/nontext and links prediction at the pixel level. TextSnake [4] learns to predict local attributes, including the text centre line, text region, radius, and orientation, achieving improvements of up to 20% accuracy on curved benchmarks. CRAFT [15] trains a convolutional neural network producing the character region score and affinity score. PSENet [16] projects the feature map into several branches to produce multiple segmentation maps. TextField [29] detects scene text by predicting a direction field pointing away from the nearest text boundary to each text point. Text mountain [30] predicts text centre-border probability and text centre-direction to detect the scene text. Text detectors based on instance segmentation perform better with higher precision annotation.


## 2.3. Weak Supervision Semantic Segmentation

Sun et al. [31] leveraged the power of deep semantic segmentation CNNs while avoiding requiring expensive annotations for training. Rtfnet [32] took advantage of thermal images and fused both the RGB and thermal information in a novel deep neural network. Tang et al. [33] proposed a normalized cut loss for semisupervised learning; the loss combines partial crossentropy on labelled pixels and normalized cut for unlabelled pixels. Wang et al. [1] proposed a self-supervised approach and developed a pipeline to label drivable areas and road anomalies using RGB-D images automatically.


## 2.4. Weak Supervision Text Detection Methods

WeText [34] trains scene text detection models on a small number of character-level annotated text images, followed by boosting the performance with a much larger number of weakly annotated images at the word/text line level. WordSup [35] trains a character detector by exploiting word annotations in rich large-scale real scene text datasets.Recently, all detectors have been trained with fully annotated masks, requiring pixel-level accuracy for good quality prediction. Motivated by weakly supervised semantic segmentation [34, 36–38], we propose a weakly supervised scene text detector to alleviate the labelling consumption without losing high precision.


## 3. Method

In this section, we first introduce the overall pipeline of the proposed network. Second, the label and the procedure for enhancing the text line are described in detail. Furthermore, the designed loss function for weakly supervised learning is introduced. Finally, we list the simple postprocessing mechanism.


### 3.1. Overview

Figure2 shows the overall pipeline of the proposed method, which is divided into three steps: (1) the model pretrained on a synthetic dataset [17], (2) label enhanced on a real dataset, and (3) training with the enhanced label. In the first step, the model is pretrained on a synthetic dataset with the full mask to make our model sensitive to the text region. In the second step, the pretrained model outputs an activation map of a real image as a supplement to the weakly annotated label (i.e., text line). In the final step, the enhanced label is fed back to optimize the network parameters. The output of the model in the final step forms the final prediction result through a contour search.Figure 2
The overall procedure of the proposed method. (1) The network pretraining on SynthText for one epoch with full masks. (2) Enhancing the label (i.e., text line) with the pretrained model. (3) The enhanced annotation information is feedback to train the network in a weakly supervised manner.


### 3.2. Labelling and Label Enhancement

#### 3.2.1. Text Line

In this paper, we define the text line as a line across the text region, as shown in Figure3. All characters within this text region should be connected with a continuous line (e.g., TL-1 to TL-5). There are no width and curvature requirements for these text lines. However, improper annotations such as TL-6 will result in an obvious decline in text detection accuracy. The BG in Figure 3 represents the background annotation, which has no requirements for the geometric parameters (e.g., shape, width, length, and curvature) of the line. As a result, the TL and the BG constitute the original annotation.Figure 3
Text line labelling: a sample of text line labelling.


#### 3.2.2. Soft Label

The soft label containing the distance (location) information is used in our method. The shortest distance between each text pixel and the background is calculated. Then, we map these distance values to [0, 1] as the soft label. For pixels concentrated in the centre of the text instance, a strong (high) value that tends to 1 should be given. However, for the estimated edge area, a weak (low) value that tends to 0 should be assigned. As shown in Figure2 (activation map), the distance-mountain-like activation map is predicted from the model pretrained on SynthText. The shape of the soft label is the same as the distance-mountain shape. The value Pi of the label is calculated using the following equation:(1)Pi=DiDmax,where Di is the shortest distance between each text pixel (i) and the background pixels. Dmax is the maximum value for all Dis in the same text instance.


#### 3.2.3. Label Enhancement

As shown in Figure2, label enhancement is an important step in the overall pipeline. The detailed processing of the enhancement is as follows: the network is first pretrained on SynthText for one epoch with full masks, making it sensitive to text areas. The activation maps of real images are generated using the above pretrained model. Then, we extract the text skeleton for the given weakly supervised label. Finally, the intersection of the text activation region and the text skeleton is expanded to obtain more annotation information. The only purpose of label enhancement is to use the text line to locate the correct detection text region in the activation map of the real image and to obtain more supervision information. Enhanced labels only work on the positive part (i.e., text line), while background annotations are excluded.Figure2 (right) describes the combination of the text skeleton and activation maps. We first use the text skeleton to locate the corresponding text activation region in the activation map and then attempt to seek the corresponding text edge region through continuous dilation of the intersection of the text activation region and the text skeleton. Detailed seeking refers to considering a pixel as the edge pixel by estimating whether the pixel value approaches 0. Finally, the values of pixels deemed as edge pixels are used as the supplement to enhance the original annotation (i.e., text line). Note that the values in the activation map are not common binary probabilities (i.e., text/nontext prediction) but represent location (distance) values. Therefore, we can use the value of each pixel in the text region to confirm the relative distance from the background.


### 3.3. Network Design

We chose VGG16 [39] as our feature extractor for a fair comparison with other methods. The images are first downsampled to the multilevel features with five convolution blocks, and five feature maps (i.e.,P1,P2,P3,P4,P5) are generated in the step. Then, the features are gradually upsampled to the original size and mixed with the corresponding output of the previous convolution block:(2)O=UP1UpP2UpP3UpP4UpP5,Upp=DeconvConv3,3Conv1,1p,where “ refers to the feature concatenation and Up is the upsample function that is used to feed the feature map into the Conv1,1-Conv3,3-Deconv-ReLU layers. The difference in U for Up is obtained without the ReLU layer and reducing the channel number to 1 as the output. Finally, the output obtained through the sigmoid function is used to calculate the loss of the prediction. In addition to the VGG16, other backbones (i.e., ResNet) were also adopted in a comparative study in Section 4.6 Ablation Study.


### 3.4. Loss Function

The prediction is a two-dimensional feature map, and we map the value to [0, 1] using the sigmoid function. These values in a text instance are not the confidences of each pixel but represent the degrees of the shortest distance between each pixel and the background. The common binary crossentropy loss function is(3)LCE=−∑t×lny+1−t×ln1−y,where t is the ground truth and y is the prediction. The common crossentropy is used to evaluate the confidence of a certain category but cannot calculate the loss value with specific meanings (e.g., our distance values).In that case, we seek to optimize the loss containing distance values byL1loss:fx−Y or L2loss:fx−Y2. However, we find that L1 and L2 are not sensitive to the distance distribution among [0, 1]. For instance, the L1 loss between the ground truth of 0.5 and the prediction result of 0.55 is too small and not conducive to backpropagation.To solve the above difficulty, thedegree crossentropy is proposed. The degree crossentropy can not only evaluate the confidence of category but also deal with the distance information. Losses for the positive and negative pixels are calculated according to(4)Lnegative=LCEx,y×GTx,y==0,Lpositive=LDCEx,y×Uc/e×GTx,y≠0,where LCEx,y is the traditional crossentropy loss of pixel x,y and GTx,y is the corresponding ground truth of pixel x,y. Since the enhanced label may not be accurate, we treat the given label and the postenhanced supplements separately. Uc/e is a discriminatory mechanism that calculates the losses of the original label and postenhanced part, respectively. LDCEx,y is the degree crossentropy loss:(5)LDCE=−ln1−absGT−Predp,where Predp is the predicted result after the sigmoid function and GT is the ground truth. The loss of prediction and any goal ∈[0, 1] is calculated to help us to deal with distance degree information of the text. The specific implementation of Uc/e is described by(6)Uc/e=1,Px,y∈TLx,y,1,Px,y∈DPx,y∩G,0,others,G=absGTx,y−Predx,y>ρ,where Px,y refers to pixel x,y in the entire prediction map. TLx,y and DPx,y represent the annotated pixels x,y and postenhanced pixels x,y, respectively. G is one set of pixels with a difference of more than ρ between the ground truth and prediction. The postenhanced annotation from the pretrained model may not be quite accurate, and noise interference may exist. Several situations are present in label enhancing. For instance, background pixels are viewed as text pixels as positive annotations. The causes are the annotation differences in the datasets and the unreliability of the prediction. To make our network learn from noisy or wrong labels, we propose a discriminatory mechanism called Uc/e, which calculates the losses of the original label and postenhanced part. In that case, the network performs strong-supervised learning on labelled pixels and distribution supervised learning on postenhanced pixels. More specifically, the predicted pixel values gradually decrease from the text centre to the edge without fitting the value of the label. The difference between the enhanced annotation and predicted results will be considered reasonable if it is smaller than ρ. The value of ρ is set to 0.1 in all the experiments. Therefore, the fault tolerance of Uc/e can enhance the robustness of the model and avoid some mistakes from the postenhanced annotation.


### 3.5. Postprocessing

Most segmentation-based methods with segmentation have a common difficulty in which the separation of text instances that are close to each other is challenging. To solve this problem, we propose the apex-edge expansion algorithm that makes full use of the text-mountain shape. Given the prediction result, each text instance appears as a text mountain, as shown in Figure4(a), where the text centre line region is the peak and the values of the pixels tend to 1. The text edge pixel areas are similar to the feet of the mountain, and their contents are mostly close to zero. Figure 4 presents a vivid example to illustrate the detailed procedure of the apex-edge expansion algorithm.Figure 4
Apex-edge expansion: the diagram shows the whole expansion postprocessing process. (a) The original image and the predicted result. (b) Sketch of the expansion showing how to expand from the apex to the edge of the text instance. (c) A more detailed explanation in the two-dimensional decimal matrix. (d) The prediction result.The detailed procedure of the apex-edge expansion algorithm is shown in Figures4(b) and 4(c). The postprocessing mainly includes three parts. (1) The peak of each text mountain is selected to differentiate the different text instances. The pixel block for which the values of each inner pixel approach 1 is the peak. (2) The dilate in OpenCV is used to expand the peak region continuously until reaching the mountain foot or meeting other text areas. The expansion process is divided into many steps S1,S2,…,Sn. Si (i∈1,n) represents the entire expansion area in the ith step. Si−Si−1(i∈2,n) is called the extended area between two adjacent steps. The criterion of expansion ending is that the average score of the extended area approaches 0 or starts to increase. The average score approaching 0 means that the expansion area is close to the background. The increase in the score means that the expansion area begins to cover other text instances. (3) The contour of the whole text instance is represented by many coordinates as the final prediction result after the expansion. The entire postprocessing is shown in Algorithm 1, where Sn represents the prediction result, and the output Dn is the set of text instances. Dilation (.) is the dilate operation in OpenCV. The value and size of the expansion kernel in dilation (.) can be changed to realize different direction expansions and different scale expansions. Mean (.) is used to calculate the average value of a matrix. ‐represents complementing the set. ⟶ and Δ refer to tending to a number and the value increasing, respectively.Algorithm 1: Apex-edge expansion algorithm.
Input:Sn: Segmentation resultOutput:Dn: Text instancesDn⟸ϕApexs⟸Snx,y⟶1forApex∈Apexs doifApex>minimum thenDKdilated kernel⟸Apexwhileiter<max_iter donext_DK⟸Dilation (DK)//expansion operationscore_DK⟸Mean (next_DK∩DK¯∩Sn)//get the average score of the extended regionifscore_DK⟶0 or score_DKΔthenEnqueueDn,next_DK//push result into Dnbreakend ifDK⟸next_DKend whileend ifend for


## 3.1. Overview

Figure2 shows the overall pipeline of the proposed method, which is divided into three steps: (1) the model pretrained on a synthetic dataset [17], (2) label enhanced on a real dataset, and (3) training with the enhanced label. In the first step, the model is pretrained on a synthetic dataset with the full mask to make our model sensitive to the text region. In the second step, the pretrained model outputs an activation map of a real image as a supplement to the weakly annotated label (i.e., text line). In the final step, the enhanced label is fed back to optimize the network parameters. The output of the model in the final step forms the final prediction result through a contour search.Figure 2
The overall procedure of the proposed method. (1) The network pretraining on SynthText for one epoch with full masks. (2) Enhancing the label (i.e., text line) with the pretrained model. (3) The enhanced annotation information is feedback to train the network in a weakly supervised manner.


## 3.2. Labelling and Label Enhancement

### 3.2.1. Text Line

In this paper, we define the text line as a line across the text region, as shown in Figure3. All characters within this text region should be connected with a continuous line (e.g., TL-1 to TL-5). There are no width and curvature requirements for these text lines. However, improper annotations such as TL-6 will result in an obvious decline in text detection accuracy. The BG in Figure 3 represents the background annotation, which has no requirements for the geometric parameters (e.g., shape, width, length, and curvature) of the line. As a result, the TL and the BG constitute the original annotation.Figure 3
Text line labelling: a sample of text line labelling.


### 3.2.2. Soft Label

The soft label containing the distance (location) information is used in our method. The shortest distance between each text pixel and the background is calculated. Then, we map these distance values to [0, 1] as the soft label. For pixels concentrated in the centre of the text instance, a strong (high) value that tends to 1 should be given. However, for the estimated edge area, a weak (low) value that tends to 0 should be assigned. As shown in Figure2 (activation map), the distance-mountain-like activation map is predicted from the model pretrained on SynthText. The shape of the soft label is the same as the distance-mountain shape. The value Pi of the label is calculated using the following equation:(1)Pi=DiDmax,where Di is the shortest distance between each text pixel (i) and the background pixels. Dmax is the maximum value for all Dis in the same text instance.


### 3.2.3. Label Enhancement

As shown in Figure2, label enhancement is an important step in the overall pipeline. The detailed processing of the enhancement is as follows: the network is first pretrained on SynthText for one epoch with full masks, making it sensitive to text areas. The activation maps of real images are generated using the above pretrained model. Then, we extract the text skeleton for the given weakly supervised label. Finally, the intersection of the text activation region and the text skeleton is expanded to obtain more annotation information. The only purpose of label enhancement is to use the text line to locate the correct detection text region in the activation map of the real image and to obtain more supervision information. Enhanced labels only work on the positive part (i.e., text line), while background annotations are excluded.Figure2 (right) describes the combination of the text skeleton and activation maps. We first use the text skeleton to locate the corresponding text activation region in the activation map and then attempt to seek the corresponding text edge region through continuous dilation of the intersection of the text activation region and the text skeleton. Detailed seeking refers to considering a pixel as the edge pixel by estimating whether the pixel value approaches 0. Finally, the values of pixels deemed as edge pixels are used as the supplement to enhance the original annotation (i.e., text line). Note that the values in the activation map are not common binary probabilities (i.e., text/nontext prediction) but represent location (distance) values. Therefore, we can use the value of each pixel in the text region to confirm the relative distance from the background.


## 3.2.1. Text Line

In this paper, we define the text line as a line across the text region, as shown in Figure3. All characters within this text region should be connected with a continuous line (e.g., TL-1 to TL-5). There are no width and curvature requirements for these text lines. However, improper annotations such as TL-6 will result in an obvious decline in text detection accuracy. The BG in Figure 3 represents the background annotation, which has no requirements for the geometric parameters (e.g., shape, width, length, and curvature) of the line. As a result, the TL and the BG constitute the original annotation.Figure 3
Text line labelling: a sample of text line labelling.


## 3.2.2. Soft Label

The soft label containing the distance (location) information is used in our method. The shortest distance between each text pixel and the background is calculated. Then, we map these distance values to [0, 1] as the soft label. For pixels concentrated in the centre of the text instance, a strong (high) value that tends to 1 should be given. However, for the estimated edge area, a weak (low) value that tends to 0 should be assigned. As shown in Figure2 (activation map), the distance-mountain-like activation map is predicted from the model pretrained on SynthText. The shape of the soft label is the same as the distance-mountain shape. The value Pi of the label is calculated using the following equation:(1)Pi=DiDmax,where Di is the shortest distance between each text pixel (i) and the background pixels. Dmax is the maximum value for all Dis in the same text instance.


## 3.2.3. Label Enhancement

As shown in Figure2, label enhancement is an important step in the overall pipeline. The detailed processing of the enhancement is as follows: the network is first pretrained on SynthText for one epoch with full masks, making it sensitive to text areas. The activation maps of real images are generated using the above pretrained model. Then, we extract the text skeleton for the given weakly supervised label. Finally, the intersection of the text activation region and the text skeleton is expanded to obtain more annotation information. The only purpose of label enhancement is to use the text line to locate the correct detection text region in the activation map of the real image and to obtain more supervision information. Enhanced labels only work on the positive part (i.e., text line), while background annotations are excluded.Figure2 (right) describes the combination of the text skeleton and activation maps. We first use the text skeleton to locate the corresponding text activation region in the activation map and then attempt to seek the corresponding text edge region through continuous dilation of the intersection of the text activation region and the text skeleton. Detailed seeking refers to considering a pixel as the edge pixel by estimating whether the pixel value approaches 0. Finally, the values of pixels deemed as edge pixels are used as the supplement to enhance the original annotation (i.e., text line). Note that the values in the activation map are not common binary probabilities (i.e., text/nontext prediction) but represent location (distance) values. Therefore, we can use the value of each pixel in the text region to confirm the relative distance from the background.


## 3.3. Network Design

We chose VGG16 [39] as our feature extractor for a fair comparison with other methods. The images are first downsampled to the multilevel features with five convolution blocks, and five feature maps (i.e.,P1,P2,P3,P4,P5) are generated in the step. Then, the features are gradually upsampled to the original size and mixed with the corresponding output of the previous convolution block:(2)O=UP1UpP2UpP3UpP4UpP5,Upp=DeconvConv3,3Conv1,1p,where “ refers to the feature concatenation and Up is the upsample function that is used to feed the feature map into the Conv1,1-Conv3,3-Deconv-ReLU layers. The difference in U for Up is obtained without the ReLU layer and reducing the channel number to 1 as the output. Finally, the output obtained through the sigmoid function is used to calculate the loss of the prediction. In addition to the VGG16, other backbones (i.e., ResNet) were also adopted in a comparative study in Section 4.6 Ablation Study.


## 3.4. Loss Function

The prediction is a two-dimensional feature map, and we map the value to [0, 1] using the sigmoid function. These values in a text instance are not the confidences of each pixel but represent the degrees of the shortest distance between each pixel and the background. The common binary crossentropy loss function is(3)LCE=−∑t×lny+1−t×ln1−y,where t is the ground truth and y is the prediction. The common crossentropy is used to evaluate the confidence of a certain category but cannot calculate the loss value with specific meanings (e.g., our distance values).In that case, we seek to optimize the loss containing distance values byL1loss:fx−Y or L2loss:fx−Y2. However, we find that L1 and L2 are not sensitive to the distance distribution among [0, 1]. For instance, the L1 loss between the ground truth of 0.5 and the prediction result of 0.55 is too small and not conducive to backpropagation.To solve the above difficulty, thedegree crossentropy is proposed. The degree crossentropy can not only evaluate the confidence of category but also deal with the distance information. Losses for the positive and negative pixels are calculated according to(4)Lnegative=LCEx,y×GTx,y==0,Lpositive=LDCEx,y×Uc/e×GTx,y≠0,where LCEx,y is the traditional crossentropy loss of pixel x,y and GTx,y is the corresponding ground truth of pixel x,y. Since the enhanced label may not be accurate, we treat the given label and the postenhanced supplements separately. Uc/e is a discriminatory mechanism that calculates the losses of the original label and postenhanced part, respectively. LDCEx,y is the degree crossentropy loss:(5)LDCE=−ln1−absGT−Predp,where Predp is the predicted result after the sigmoid function and GT is the ground truth. The loss of prediction and any goal ∈[0, 1] is calculated to help us to deal with distance degree information of the text. The specific implementation of Uc/e is described by(6)Uc/e=1,Px,y∈TLx,y,1,Px,y∈DPx,y∩G,0,others,G=absGTx,y−Predx,y>ρ,where Px,y refers to pixel x,y in the entire prediction map. TLx,y and DPx,y represent the annotated pixels x,y and postenhanced pixels x,y, respectively. G is one set of pixels with a difference of more than ρ between the ground truth and prediction. The postenhanced annotation from the pretrained model may not be quite accurate, and noise interference may exist. Several situations are present in label enhancing. For instance, background pixels are viewed as text pixels as positive annotations. The causes are the annotation differences in the datasets and the unreliability of the prediction. To make our network learn from noisy or wrong labels, we propose a discriminatory mechanism called Uc/e, which calculates the losses of the original label and postenhanced part. In that case, the network performs strong-supervised learning on labelled pixels and distribution supervised learning on postenhanced pixels. More specifically, the predicted pixel values gradually decrease from the text centre to the edge without fitting the value of the label. The difference between the enhanced annotation and predicted results will be considered reasonable if it is smaller than ρ. The value of ρ is set to 0.1 in all the experiments. Therefore, the fault tolerance of Uc/e can enhance the robustness of the model and avoid some mistakes from the postenhanced annotation.


## 3.5. Postprocessing

Most segmentation-based methods with segmentation have a common difficulty in which the separation of text instances that are close to each other is challenging. To solve this problem, we propose the apex-edge expansion algorithm that makes full use of the text-mountain shape. Given the prediction result, each text instance appears as a text mountain, as shown in Figure4(a), where the text centre line region is the peak and the values of the pixels tend to 1. The text edge pixel areas are similar to the feet of the mountain, and their contents are mostly close to zero. Figure 4 presents a vivid example to illustrate the detailed procedure of the apex-edge expansion algorithm.Figure 4
Apex-edge expansion: the diagram shows the whole expansion postprocessing process. (a) The original image and the predicted result. (b) Sketch of the expansion showing how to expand from the apex to the edge of the text instance. (c) A more detailed explanation in the two-dimensional decimal matrix. (d) The prediction result.The detailed procedure of the apex-edge expansion algorithm is shown in Figures4(b) and 4(c). The postprocessing mainly includes three parts. (1) The peak of each text mountain is selected to differentiate the different text instances. The pixel block for which the values of each inner pixel approach 1 is the peak. (2) The dilate in OpenCV is used to expand the peak region continuously until reaching the mountain foot or meeting other text areas. The expansion process is divided into many steps S1,S2,…,Sn. Si (i∈1,n) represents the entire expansion area in the ith step. Si−Si−1(i∈2,n) is called the extended area between two adjacent steps. The criterion of expansion ending is that the average score of the extended area approaches 0 or starts to increase. The average score approaching 0 means that the expansion area is close to the background. The increase in the score means that the expansion area begins to cover other text instances. (3) The contour of the whole text instance is represented by many coordinates as the final prediction result after the expansion. The entire postprocessing is shown in Algorithm 1, where Sn represents the prediction result, and the output Dn is the set of text instances. Dilation (.) is the dilate operation in OpenCV. The value and size of the expansion kernel in dilation (.) can be changed to realize different direction expansions and different scale expansions. Mean (.) is used to calculate the average value of a matrix. ‐represents complementing the set. ⟶ and Δ refer to tending to a number and the value increasing, respectively.Algorithm 1: Apex-edge expansion algorithm.
Input:Sn: Segmentation resultOutput:Dn: Text instancesDn⟸ϕApexs⟸Snx,y⟶1forApex∈Apexs doifApex>minimum thenDKdilated kernel⟸Apexwhileiter<max_iter donext_DK⟸Dilation (DK)//expansion operationscore_DK⟸Mean (next_DK∩DK¯∩Sn)//get the average score of the extended regionifscore_DK⟶0 or score_DKΔthenEnqueueDn,next_DK//push result into Dnbreakend ifDK⟸next_DKend whileend ifend for


## 4. Experiments

In this section, we evaluate our approach using ICDAR2015, Total-Text, MSRA-TD500, and CTW1500. The experimental results demonstrate that the performance of the proposed method is comparable to those of the other methods.


### 4.1. Datasets

The datasets used for testing our method are briefly introduced below:SynthText is a large-scale dataset that contains approximately 800 K synthetic images. These images were created by blending natural images with text rendered with random fonts, sizes, colours, and orientations. We used this dataset to pretrain our model.ICDAR2015 is a multioriented text detection dataset for English text that includes only 1,000 training images and 500 testing images. The text regions were annotated by four vertices of the quadrilateral.MSRA-TD500 contains 500 natural images. The indoor images are mainly signs, doorplates, and caution plates, while the outdoor images are mostly guided boards and billboards in complex backgrounds.Total-Text is a world-level English curved text dataset that is split into training and testing sets with 1,255 and 300 images, respectively. The text in these images includes more than 3 different text orientations: horizontal, multioriented, and curved.SCUT-CTW1500 contains 1,000 training images and 500 test images, which contain multioriented text, curved text, and irregularly shaped text. Text regions in this dataset are labelled with 14 scene text boundary points at the sentence level.Data labelling to test our method: we manually marked Total-Text, CTW1500, and TD500. As shown in Figure5, the annotation method was brief and inexpensive. For ICDAR2015, the official label was used to fit the text line label for the further verification experiment. The detailed fitting method is simple. The text skeleton as a text line is extracted directly from the full label. All annotations will be released.Figure 5
The comparison between the text line label and original annotation for three benchmarks. The row on the top is the visualization of the original annotation on (a) CTW1500, (b) Total-Text, and (c) TD500. The middle row is text line annotation and is labelled. The bottom row is the visualization of detection results for the proposed method.
(a)(b)(c)


### 4.2. Implementation Details

#### 4.2.1. Training

The network was pretrained on SynthText for one epoch and fine tuned on other datasets. We adopted the Adam optimizer as our learning rate scheme. During the pretraining phase, the learning rate was fixed to 0.001. During the fine-tuning stage, the learning rate was initially set to 0.0001 and decayed at a rate of 0.94 every 10,000 insertions. All of the experiments were conducted on a regular workstation (CPU: Intel (R) Core (TM) i7-7800X CPU @ 3.50 GHz; GPU: GTX 1080). The model was trained with a batch of 4 on one GPU.VGG16 was adopted as the backbone network for the contrast experiment in our experiments. All of the experiments use the same training strategy: (1) enhancing the text annotation information with the model pretrained on SynthText and (2) training network on the target dataset. To validate the robustness of the proposed method and keep the same condition in the comparative experiments, all of the models used in label enhancement were the same model pretrained on SynthText for one epoch.


#### 4.2.2. Data Augmentation

The images were randomly rotated, cropped, and mirrored at a probability of 0.4. Then, colour and lightness were randomly adjusted. Finally, the images were uniformly resized to 512 × 512.


#### 4.2.3. Postprocessing

We obtained all of the text instances with the apex-edge expansion and then usedfindContours in OpenCV to obtain a set of edge coordinates for each text instance. Finally, the text instances of the regular text datasets (i.e., MSRA-TD500) were described by four coordinate points. Methods such as minAreaRect in OpenCV were applied to obtain the bounding boxes of text instances. For curved text datasets, we used a set of coordinate points to describe the text instance (Tables 1 and 2).Table 1
Experimental results for Total-Text. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask on Total-Text. All listed results were obtained in a strongly supervised manner.
MethodExt.Total-TextPrecisionRecallF-measureFPSSegLink [40]—30.023.826.7—EAST [13]—50.036.242.0—Mask TextSpotter [12]—69.055.061.3—PSENet [16]—81.875.178.33.9[41]√80.976.278.510.0TextSnake [4]√82.774.578.4—PSENet [16]√84.078.080.93.9SPCNet [14]√83.082.882.9—CRAFT [15]√87.679.983.68.6FM (ours)PT83.181.682.410.4TAS (ours)PT78.576.777.611.2Table 2
Experimental results for CTW1500. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask for strong-supervised learning.
MethodExt.CTW1500PrecisionRecallF-measureFPSCTPN [42]—60.453.856.97.14SegLink [40]—42.340.040.8—EAST [13]—78.749.160.4—CTD + TLOC [43]—77.469.873.4—PSENet [16]—80.675.678.03.9TextSnake [4]√67.985.375.6—[41]√80.280.180.110TextField [29]√79.883.081.4PSENet [16]√84.879.782.23.9CRAFT [15]√88.278.282.98.6FM (ours)PT86.280.583.29.0TAS (ours)PT83.880.882.39.2


### 4.3. Detecting Curve Text

The CTW1500 and Total-Text datasets were used to test the ability of curve text detection. In the experiments, manual text line annotation is used for training. The model pretrained with one epoch on SynthText had two effects: one was to heighten the annotation information, and the other was fine-tuning the pretrained model on other datasets.The training started with the pretrained model and achieved the best result between 20 and 40 epochs. The F-measure showed a fluctuation of approximately5%, while the threshold of the peak was in [0.5, 0.8]. For comparative experiments, the threshold of the peak in the apex-edge expansion algorithm was set to 0.6 for CTW1500 and Total-Text for comparative experiments. We continued to expand the peak region until the average score of the extended area approached 0 or met another text instance.The F-measure of our method with text line was77.6% on Total-Text, while the F-measure of our method with full masks was 81.1%, as shown in Table 3. The performance with full masks was close to that of the newest method. The difference (3.5%) shows that using the text line can still achieve good results on the challenging poor annotation. The recall (76.7%) was close to the values obtained for the other methods. On CTW1500, our method showed excellent results that were very close to the results obtained by the other strong-supervised methods with an F-measure of 82.3%. The difference (1.9%) between the F-measure of using the text line and that of using the full mask was also acceptable.Table 3
Effectiveness of label enhancement and the pretrained model on Total-Text.
MethodPretrain-enhancementLabelF-measureBaseline + TLNoTL65.0Baseline + FLNoFull81.1Baseline + TL∗ + PTSynthTextTL∗77.6Baseline + TL + PTΔCTW1500TL79.1Baseline + TL + PTSynthTextTL77.2FL and TL refer to using full mask and text line label, respectively. TL∗ is the synthetic text line label. PT and PTΔ are the different models pretrained on SynthText and CTW1500, respectively.


### 4.4. Detecting Long Text

TD500 contains many long text scenes and therefore is an excellent dataset for verifying the robustness of the network in long text cases. In the experiment, text line annotation was enhanced by the model pretrained on SynthText. The pretrained model was also used for fine-tuning on TD500. The threshold of the peak in the apex-edge expansion algorithm was set to 0.6, which is the same value as the experiments on CTW1500 and Total-Text. Table4 compares the proposed method with state-of-the-art methods on TD500. The proposed method achieved an F-measure of 77.2%, which is competitive with other state-of-the-art detectors trained in a strongly supervised way.Table 4
Experimental results for SCUT-TD500. “PT”refers to the model pretrained on SynthText. “Ext.” indicates external data. All compared methods were trained in a strongly supervised way. “FM” refers to the model trained with a full mask for strong-supervised learning.
MethodExt.MSRA-TD500PrecisionRecallF-measureFPSEAST [13]—87.367.476.113.2RRPN [20]—82.068.074.0—DeepReg [18]—77.070.074.01.1SegLink [40]√86.070.077.08.9PixelLink [28]√83.073.277.83.0RRD [26]√87.073.079.010TextSnak [4]√83.273.978.31.1[44]√87.676.282.9—TextField [29]√75.987.481.3—CRAFT [15]√88.278.282.98.6MCN [45]√79.088.083.0—FM (ours)PT83.276.679.811.6TAS (ours)PT80.674.177.212.0


### 4.5. Detecting Oriented Text

All of the parameter settings and training details for ICDAR2015 were the same as those for the experiments on the curve text datasets. The official label was used to fit the text line label for the further verified experiment on ICDAR2015. Similar to the experiment on TD500,minAreaRect in OpenCV was used to obtain the bounding boxes of the text instance, in contrast to several detectors listed in Table 5 that used extra datasets. For instance, the F-measure of PSENet [16] was 80.5% without an extra dataset. The F-measure (79.4%) of our method was already comparatively close to those of the other methods.Table 5
Experimental results for ICDAR2015. “PT”refers to the model pretrained on SynthText for one epoch. “Ext.” indicates using external data.
MethodExt.ICDAR15PrecisionRecallF-measureFPSCTPN [42]—74.251.660.97.1EAST [13]—83.673.578.26.5RRPN [20]—82.073.077.0—PSENet [16]—81.479.680.51.6PixelLink [28]—82.981.782.37.3SegLink [40]√73.176.875.0—SSTD [46]√80.273.976.97.7WordSup [35]√79.377.078.2—RRD [26]√85.679.082.26.5MCN [45]√72.080.076.0—TextField [29]√80.584.382.4—TextSnake [4]√84.980.482.61.1PAN [47]√84.081.982.926.1PSENet [16]√86.984.585.71.6CRAFT [15]√89.884.386.98.6SPCNet [14]√88.785.887.2—TAS (ours)PT81.777.179.48.5


### 4.6. Ablation Study

Three groups of comparative experiments were performed to verify the effectiveness of our method.


#### 4.6.1. Baseline

The baseline was trained with the text line without label enhancement, and the F-measure of the baseline on Total-Text was65.0%, as shown in Table 3.


#### 4.6.2. Label Enhancement

The results are shown in Table3, which are further analysed for label enhancement of the model on Total-Text. Training with an unenhanced text line shows an unsatisfactory performance (65.0%), while training with a full mask obtained an F-measure of 81.1%. The large difference (16.1%) indicates that the text line loses important supervision information. After introducing the pretrained model on SynthText to enhance the text line, the performance of the model had an obvious improvement from 65.0% to 77.2%. In addition, using the synthetic text line from the full mask shows better performance (77.6%). The main reason for this is that the manual text line had a larger error in extracting the text skeleton compared to the synthetic text line. In addition, we also compared the performance of the model pretrained on different datasets: synthetic data (i.e., SynthText) and realistic data (i.e., SUCT-CTW1500). The F-measures using SynthText and CTW1500 were 77.2% and 79.1%, respectively. Obviously, the performance of our model pretrained with realistic data shows a few advantages. This also indicates an intrinsic limitation of this method and the dependence on the pretrained model.


#### 4.6.3. Geometric Parameters of the Text Line

As shown in Table6, the impact of the width and the offset of the text line was evaluated. For the width of the text line, we used different widths of synthetic or manually marked text lines to test our model. For the manually marked text line, we extracted its skeleton of one-pixel width and dilated the skeleton to different widths while the width was less than that of the original text line. For the synthetic text line, the skeleton of one pixel was extracted from the full mask and used to create different widths. While the width of the text line was the same, using the synthetic text line which usually achieved a better performance than using the manual text line, and the average difference was approximately 0.4%. In addition, with increasing width, the F-measure showed a fluctuation of approximately 1%. The offset of the text line was set to 0 in all experiments to evaluate the influence of the text line width.Table 6
Effectiveness of different text line labelling qualities on Total-Text.
Width (pixel)MethodF-measureMethodF-measure1Baseline + TL77.2Baseline + TL∗77.63Baseline + TL77.8Baseline + TL∗77.85Baseline + TL77.5Baseline + TL∗78.47Baseline + TL78.1Baseline + TL∗78.3MethodWidth (pixel)Offset (%)F-measure—Baseline + TL∗1077.6—Baseline + TL∗11077.4—Baseline + TL∗12077.8—Baseline + TL∗13076.4—Baseline + TL∗14075.2—TL∗ is the synthetic text line with a full mask. TL refers to the manually marked text line.Apart from the evaluation of the influence of width, the offset between the synthetic text line and centre line of the text instance was also set to test our detection method. The offset in Table6 refers to the offset error ratio: Do/Dt. Do is the distance between the text line and text centre line, and Dt is the width of the text region. In the experiment, we only performed the experiment on the synthetic text line, while the offset between the manual text line and text centre line was difficult to calculate. The text centre line was calculated from the original coordinate annotation, and then we created the text line by setting the corresponding offset ratio. The curvature and width of the created text line were the same as those of the text centre line. All widths of the text line or text centre line were one pixel in the experiment. While the offset ratio of the text line was below 20%, the F-measure barely fluctuated. While the offset ratio of the text line exceeded 20%, the performance of the model started to be affected slightly, but the fluctuation around 2% was still acceptable.


#### 4.6.4. Backbone

As shown in Table7, a series of experiments comparing different backbones were performed to evaluate its influence on the proposed method. Similar to VGG16, five feature maps generated from VGG11 were gradually upsampled to the original size. For the ResNet series, four feature maps were used to merge. The F-measure using VGG11 was similar to that of using VGG16, but the latter had a slightly slower inference time. Due to the sophisticated design, the ResNet series had a longer convergence time, but the performance was comparatively accurate and stable.Table 7
Detection results with different backbones on CTW1500.
BackboneMethodPrecisionRecallF-measureFPSVGG16Baseline + TL83.880.882.39.2VGG11Baseline + TL82.581.281.911.2ResNet-18Baseline + TL82.479.480.98.7ResNet-50Baseline + TL84.580.882.76.9ResNet-101Baseline + TL84.381.682.96.6


#### 4.6.5. Loss Function

As shown in Figure6(a), due to the instability of the enhanced annotation, the F-measure decreased after dozens of epochs on four common datasets, particularly for curved text datasets. As shown in Figure 6(b), training with the text line was unstable relative to the method with full labelling, and the model with full labelling showed better convergence performance with an increasing number of training epochs. After incorporating Uc/e into the loss function, the model with the text line showed improved convergence, with convergence fluctuation of approximately 3%.Figure 6
Influence of training epochs: (a) results for different datasets with the text line and (b) results for the same dataset with different annotations.∗ represents Uc/e used in the loss function.
(a)(b)


## 4.1. Datasets

The datasets used for testing our method are briefly introduced below:SynthText is a large-scale dataset that contains approximately 800 K synthetic images. These images were created by blending natural images with text rendered with random fonts, sizes, colours, and orientations. We used this dataset to pretrain our model.ICDAR2015 is a multioriented text detection dataset for English text that includes only 1,000 training images and 500 testing images. The text regions were annotated by four vertices of the quadrilateral.MSRA-TD500 contains 500 natural images. The indoor images are mainly signs, doorplates, and caution plates, while the outdoor images are mostly guided boards and billboards in complex backgrounds.Total-Text is a world-level English curved text dataset that is split into training and testing sets with 1,255 and 300 images, respectively. The text in these images includes more than 3 different text orientations: horizontal, multioriented, and curved.SCUT-CTW1500 contains 1,000 training images and 500 test images, which contain multioriented text, curved text, and irregularly shaped text. Text regions in this dataset are labelled with 14 scene text boundary points at the sentence level.Data labelling to test our method: we manually marked Total-Text, CTW1500, and TD500. As shown in Figure5, the annotation method was brief and inexpensive. For ICDAR2015, the official label was used to fit the text line label for the further verification experiment. The detailed fitting method is simple. The text skeleton as a text line is extracted directly from the full label. All annotations will be released.Figure 5
The comparison between the text line label and original annotation for three benchmarks. The row on the top is the visualization of the original annotation on (a) CTW1500, (b) Total-Text, and (c) TD500. The middle row is text line annotation and is labelled. The bottom row is the visualization of detection results for the proposed method.
(a)(b)(c)


## 4.2. Implementation Details

### 4.2.1. Training

The network was pretrained on SynthText for one epoch and fine tuned on other datasets. We adopted the Adam optimizer as our learning rate scheme. During the pretraining phase, the learning rate was fixed to 0.001. During the fine-tuning stage, the learning rate was initially set to 0.0001 and decayed at a rate of 0.94 every 10,000 insertions. All of the experiments were conducted on a regular workstation (CPU: Intel (R) Core (TM) i7-7800X CPU @ 3.50 GHz; GPU: GTX 1080). The model was trained with a batch of 4 on one GPU.VGG16 was adopted as the backbone network for the contrast experiment in our experiments. All of the experiments use the same training strategy: (1) enhancing the text annotation information with the model pretrained on SynthText and (2) training network on the target dataset. To validate the robustness of the proposed method and keep the same condition in the comparative experiments, all of the models used in label enhancement were the same model pretrained on SynthText for one epoch.


### 4.2.2. Data Augmentation

The images were randomly rotated, cropped, and mirrored at a probability of 0.4. Then, colour and lightness were randomly adjusted. Finally, the images were uniformly resized to 512 × 512.


### 4.2.3. Postprocessing

We obtained all of the text instances with the apex-edge expansion and then usedfindContours in OpenCV to obtain a set of edge coordinates for each text instance. Finally, the text instances of the regular text datasets (i.e., MSRA-TD500) were described by four coordinate points. Methods such as minAreaRect in OpenCV were applied to obtain the bounding boxes of text instances. For curved text datasets, we used a set of coordinate points to describe the text instance (Tables 1 and 2).Table 1
Experimental results for Total-Text. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask on Total-Text. All listed results were obtained in a strongly supervised manner.
MethodExt.Total-TextPrecisionRecallF-measureFPSSegLink [40]—30.023.826.7—EAST [13]—50.036.242.0—Mask TextSpotter [12]—69.055.061.3—PSENet [16]—81.875.178.33.9[41]√80.976.278.510.0TextSnake [4]√82.774.578.4—PSENet [16]√84.078.080.93.9SPCNet [14]√83.082.882.9—CRAFT [15]√87.679.983.68.6FM (ours)PT83.181.682.410.4TAS (ours)PT78.576.777.611.2Table 2
Experimental results for CTW1500. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask for strong-supervised learning.
MethodExt.CTW1500PrecisionRecallF-measureFPSCTPN [42]—60.453.856.97.14SegLink [40]—42.340.040.8—EAST [13]—78.749.160.4—CTD + TLOC [43]—77.469.873.4—PSENet [16]—80.675.678.03.9TextSnake [4]√67.985.375.6—[41]√80.280.180.110TextField [29]√79.883.081.4PSENet [16]√84.879.782.23.9CRAFT [15]√88.278.282.98.6FM (ours)PT86.280.583.29.0TAS (ours)PT83.880.882.39.2


## 4.2.1. Training

The network was pretrained on SynthText for one epoch and fine tuned on other datasets. We adopted the Adam optimizer as our learning rate scheme. During the pretraining phase, the learning rate was fixed to 0.001. During the fine-tuning stage, the learning rate was initially set to 0.0001 and decayed at a rate of 0.94 every 10,000 insertions. All of the experiments were conducted on a regular workstation (CPU: Intel (R) Core (TM) i7-7800X CPU @ 3.50 GHz; GPU: GTX 1080). The model was trained with a batch of 4 on one GPU.VGG16 was adopted as the backbone network for the contrast experiment in our experiments. All of the experiments use the same training strategy: (1) enhancing the text annotation information with the model pretrained on SynthText and (2) training network on the target dataset. To validate the robustness of the proposed method and keep the same condition in the comparative experiments, all of the models used in label enhancement were the same model pretrained on SynthText for one epoch.


## 4.2.2. Data Augmentation

The images were randomly rotated, cropped, and mirrored at a probability of 0.4. Then, colour and lightness were randomly adjusted. Finally, the images were uniformly resized to 512 × 512.


## 4.2.3. Postprocessing

We obtained all of the text instances with the apex-edge expansion and then usedfindContours in OpenCV to obtain a set of edge coordinates for each text instance. Finally, the text instances of the regular text datasets (i.e., MSRA-TD500) were described by four coordinate points. Methods such as minAreaRect in OpenCV were applied to obtain the bounding boxes of text instances. For curved text datasets, we used a set of coordinate points to describe the text instance (Tables 1 and 2).Table 1
Experimental results for Total-Text. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask on Total-Text. All listed results were obtained in a strongly supervised manner.
MethodExt.Total-TextPrecisionRecallF-measureFPSSegLink [40]—30.023.826.7—EAST [13]—50.036.242.0—Mask TextSpotter [12]—69.055.061.3—PSENet [16]—81.875.178.33.9[41]√80.976.278.510.0TextSnake [4]√82.774.578.4—PSENet [16]√84.078.080.93.9SPCNet [14]√83.082.882.9—CRAFT [15]√87.679.983.68.6FM (ours)PT83.181.682.410.4TAS (ours)PT78.576.777.611.2Table 2
Experimental results for CTW1500. “PT”refers to the model pretrained with one epoch on SynthText. “Ext.” indicates external data. “FM” refers to the model trained with full mask for strong-supervised learning.
MethodExt.CTW1500PrecisionRecallF-measureFPSCTPN [42]—60.453.856.97.14SegLink [40]—42.340.040.8—EAST [13]—78.749.160.4—CTD + TLOC [43]—77.469.873.4—PSENet [16]—80.675.678.03.9TextSnake [4]√67.985.375.6—[41]√80.280.180.110TextField [29]√79.883.081.4PSENet [16]√84.879.782.23.9CRAFT [15]√88.278.282.98.6FM (ours)PT86.280.583.29.0TAS (ours)PT83.880.882.39.2


## 4.3. Detecting Curve Text

The CTW1500 and Total-Text datasets were used to test the ability of curve text detection. In the experiments, manual text line annotation is used for training. The model pretrained with one epoch on SynthText had two effects: one was to heighten the annotation information, and the other was fine-tuning the pretrained model on other datasets.The training started with the pretrained model and achieved the best result between 20 and 40 epochs. The F-measure showed a fluctuation of approximately5%, while the threshold of the peak was in [0.5, 0.8]. For comparative experiments, the threshold of the peak in the apex-edge expansion algorithm was set to 0.6 for CTW1500 and Total-Text for comparative experiments. We continued to expand the peak region until the average score of the extended area approached 0 or met another text instance.The F-measure of our method with text line was77.6% on Total-Text, while the F-measure of our method with full masks was 81.1%, as shown in Table 3. The performance with full masks was close to that of the newest method. The difference (3.5%) shows that using the text line can still achieve good results on the challenging poor annotation. The recall (76.7%) was close to the values obtained for the other methods. On CTW1500, our method showed excellent results that were very close to the results obtained by the other strong-supervised methods with an F-measure of 82.3%. The difference (1.9%) between the F-measure of using the text line and that of using the full mask was also acceptable.Table 3
Effectiveness of label enhancement and the pretrained model on Total-Text.
MethodPretrain-enhancementLabelF-measureBaseline + TLNoTL65.0Baseline + FLNoFull81.1Baseline + TL∗ + PTSynthTextTL∗77.6Baseline + TL + PTΔCTW1500TL79.1Baseline + TL + PTSynthTextTL77.2FL and TL refer to using full mask and text line label, respectively. TL∗ is the synthetic text line label. PT and PTΔ are the different models pretrained on SynthText and CTW1500, respectively.


## 4.4. Detecting Long Text

TD500 contains many long text scenes and therefore is an excellent dataset for verifying the robustness of the network in long text cases. In the experiment, text line annotation was enhanced by the model pretrained on SynthText. The pretrained model was also used for fine-tuning on TD500. The threshold of the peak in the apex-edge expansion algorithm was set to 0.6, which is the same value as the experiments on CTW1500 and Total-Text. Table4 compares the proposed method with state-of-the-art methods on TD500. The proposed method achieved an F-measure of 77.2%, which is competitive with other state-of-the-art detectors trained in a strongly supervised way.Table 4
Experimental results for SCUT-TD500. “PT”refers to the model pretrained on SynthText. “Ext.” indicates external data. All compared methods were trained in a strongly supervised way. “FM” refers to the model trained with a full mask for strong-supervised learning.
MethodExt.MSRA-TD500PrecisionRecallF-measureFPSEAST [13]—87.367.476.113.2RRPN [20]—82.068.074.0—DeepReg [18]—77.070.074.01.1SegLink [40]√86.070.077.08.9PixelLink [28]√83.073.277.83.0RRD [26]√87.073.079.010TextSnak [4]√83.273.978.31.1[44]√87.676.282.9—TextField [29]√75.987.481.3—CRAFT [15]√88.278.282.98.6MCN [45]√79.088.083.0—FM (ours)PT83.276.679.811.6TAS (ours)PT80.674.177.212.0


## 4.5. Detecting Oriented Text

All of the parameter settings and training details for ICDAR2015 were the same as those for the experiments on the curve text datasets. The official label was used to fit the text line label for the further verified experiment on ICDAR2015. Similar to the experiment on TD500,minAreaRect in OpenCV was used to obtain the bounding boxes of the text instance, in contrast to several detectors listed in Table 5 that used extra datasets. For instance, the F-measure of PSENet [16] was 80.5% without an extra dataset. The F-measure (79.4%) of our method was already comparatively close to those of the other methods.Table 5
Experimental results for ICDAR2015. “PT”refers to the model pretrained on SynthText for one epoch. “Ext.” indicates using external data.
MethodExt.ICDAR15PrecisionRecallF-measureFPSCTPN [42]—74.251.660.97.1EAST [13]—83.673.578.26.5RRPN [20]—82.073.077.0—PSENet [16]—81.479.680.51.6PixelLink [28]—82.981.782.37.3SegLink [40]√73.176.875.0—SSTD [46]√80.273.976.97.7WordSup [35]√79.377.078.2—RRD [26]√85.679.082.26.5MCN [45]√72.080.076.0—TextField [29]√80.584.382.4—TextSnake [4]√84.980.482.61.1PAN [47]√84.081.982.926.1PSENet [16]√86.984.585.71.6CRAFT [15]√89.884.386.98.6SPCNet [14]√88.785.887.2—TAS (ours)PT81.777.179.48.5


## 4.6. Ablation Study

Three groups of comparative experiments were performed to verify the effectiveness of our method.


### 4.6.1. Baseline

The baseline was trained with the text line without label enhancement, and the F-measure of the baseline on Total-Text was65.0%, as shown in Table 3.


### 4.6.2. Label Enhancement

The results are shown in Table3, which are further analysed for label enhancement of the model on Total-Text. Training with an unenhanced text line shows an unsatisfactory performance (65.0%), while training with a full mask obtained an F-measure of 81.1%. The large difference (16.1%) indicates that the text line loses important supervision information. After introducing the pretrained model on SynthText to enhance the text line, the performance of the model had an obvious improvement from 65.0% to 77.2%. In addition, using the synthetic text line from the full mask shows better performance (77.6%). The main reason for this is that the manual text line had a larger error in extracting the text skeleton compared to the synthetic text line. In addition, we also compared the performance of the model pretrained on different datasets: synthetic data (i.e., SynthText) and realistic data (i.e., SUCT-CTW1500). The F-measures using SynthText and CTW1500 were 77.2% and 79.1%, respectively. Obviously, the performance of our model pretrained with realistic data shows a few advantages. This also indicates an intrinsic limitation of this method and the dependence on the pretrained model.


### 4.6.3. Geometric Parameters of the Text Line

As shown in Table6, the impact of the width and the offset of the text line was evaluated. For the width of the text line, we used different widths of synthetic or manually marked text lines to test our model. For the manually marked text line, we extracted its skeleton of one-pixel width and dilated the skeleton to different widths while the width was less than that of the original text line. For the synthetic text line, the skeleton of one pixel was extracted from the full mask and used to create different widths. While the width of the text line was the same, using the synthetic text line which usually achieved a better performance than using the manual text line, and the average difference was approximately 0.4%. In addition, with increasing width, the F-measure showed a fluctuation of approximately 1%. The offset of the text line was set to 0 in all experiments to evaluate the influence of the text line width.Table 6
Effectiveness of different text line labelling qualities on Total-Text.
Width (pixel)MethodF-measureMethodF-measure1Baseline + TL77.2Baseline + TL∗77.63Baseline + TL77.8Baseline + TL∗77.85Baseline + TL77.5Baseline + TL∗78.47Baseline + TL78.1Baseline + TL∗78.3MethodWidth (pixel)Offset (%)F-measure—Baseline + TL∗1077.6—Baseline + TL∗11077.4—Baseline + TL∗12077.8—Baseline + TL∗13076.4—Baseline + TL∗14075.2—TL∗ is the synthetic text line with a full mask. TL refers to the manually marked text line.Apart from the evaluation of the influence of width, the offset between the synthetic text line and centre line of the text instance was also set to test our detection method. The offset in Table6 refers to the offset error ratio: Do/Dt. Do is the distance between the text line and text centre line, and Dt is the width of the text region. In the experiment, we only performed the experiment on the synthetic text line, while the offset between the manual text line and text centre line was difficult to calculate. The text centre line was calculated from the original coordinate annotation, and then we created the text line by setting the corresponding offset ratio. The curvature and width of the created text line were the same as those of the text centre line. All widths of the text line or text centre line were one pixel in the experiment. While the offset ratio of the text line was below 20%, the F-measure barely fluctuated. While the offset ratio of the text line exceeded 20%, the performance of the model started to be affected slightly, but the fluctuation around 2% was still acceptable.


### 4.6.4. Backbone

As shown in Table7, a series of experiments comparing different backbones were performed to evaluate its influence on the proposed method. Similar to VGG16, five feature maps generated from VGG11 were gradually upsampled to the original size. For the ResNet series, four feature maps were used to merge. The F-measure using VGG11 was similar to that of using VGG16, but the latter had a slightly slower inference time. Due to the sophisticated design, the ResNet series had a longer convergence time, but the performance was comparatively accurate and stable.Table 7
Detection results with different backbones on CTW1500.
BackboneMethodPrecisionRecallF-measureFPSVGG16Baseline + TL83.880.882.39.2VGG11Baseline + TL82.581.281.911.2ResNet-18Baseline + TL82.479.480.98.7ResNet-50Baseline + TL84.580.882.76.9ResNet-101Baseline + TL84.381.682.96.6


### 4.6.5. Loss Function

As shown in Figure6(a), due to the instability of the enhanced annotation, the F-measure decreased after dozens of epochs on four common datasets, particularly for curved text datasets. As shown in Figure 6(b), training with the text line was unstable relative to the method with full labelling, and the model with full labelling showed better convergence performance with an increasing number of training epochs. After incorporating Uc/e into the loss function, the model with the text line showed improved convergence, with convergence fluctuation of approximately 3%.Figure 6
Influence of training epochs: (a) results for different datasets with the text line and (b) results for the same dataset with different annotations.∗ represents Uc/e used in the loss function.
(a)(b)


## 4.6.1. Baseline

The baseline was trained with the text line without label enhancement, and the F-measure of the baseline on Total-Text was65.0%, as shown in Table 3.


## 4.6.2. Label Enhancement

The results are shown in Table3, which are further analysed for label enhancement of the model on Total-Text. Training with an unenhanced text line shows an unsatisfactory performance (65.0%), while training with a full mask obtained an F-measure of 81.1%. The large difference (16.1%) indicates that the text line loses important supervision information. After introducing the pretrained model on SynthText to enhance the text line, the performance of the model had an obvious improvement from 65.0% to 77.2%. In addition, using the synthetic text line from the full mask shows better performance (77.6%). The main reason for this is that the manual text line had a larger error in extracting the text skeleton compared to the synthetic text line. In addition, we also compared the performance of the model pretrained on different datasets: synthetic data (i.e., SynthText) and realistic data (i.e., SUCT-CTW1500). The F-measures using SynthText and CTW1500 were 77.2% and 79.1%, respectively. Obviously, the performance of our model pretrained with realistic data shows a few advantages. This also indicates an intrinsic limitation of this method and the dependence on the pretrained model.


## 4.6.3. Geometric Parameters of the Text Line

As shown in Table6, the impact of the width and the offset of the text line was evaluated. For the width of the text line, we used different widths of synthetic or manually marked text lines to test our model. For the manually marked text line, we extracted its skeleton of one-pixel width and dilated the skeleton to different widths while the width was less than that of the original text line. For the synthetic text line, the skeleton of one pixel was extracted from the full mask and used to create different widths. While the width of the text line was the same, using the synthetic text line which usually achieved a better performance than using the manual text line, and the average difference was approximately 0.4%. In addition, with increasing width, the F-measure showed a fluctuation of approximately 1%. The offset of the text line was set to 0 in all experiments to evaluate the influence of the text line width.Table 6
Effectiveness of different text line labelling qualities on Total-Text.
Width (pixel)MethodF-measureMethodF-measure1Baseline + TL77.2Baseline + TL∗77.63Baseline + TL77.8Baseline + TL∗77.85Baseline + TL77.5Baseline + TL∗78.47Baseline + TL78.1Baseline + TL∗78.3MethodWidth (pixel)Offset (%)F-measure—Baseline + TL∗1077.6—Baseline + TL∗11077.4—Baseline + TL∗12077.8—Baseline + TL∗13076.4—Baseline + TL∗14075.2—TL∗ is the synthetic text line with a full mask. TL refers to the manually marked text line.Apart from the evaluation of the influence of width, the offset between the synthetic text line and centre line of the text instance was also set to test our detection method. The offset in Table6 refers to the offset error ratio: Do/Dt. Do is the distance between the text line and text centre line, and Dt is the width of the text region. In the experiment, we only performed the experiment on the synthetic text line, while the offset between the manual text line and text centre line was difficult to calculate. The text centre line was calculated from the original coordinate annotation, and then we created the text line by setting the corresponding offset ratio. The curvature and width of the created text line were the same as those of the text centre line. All widths of the text line or text centre line were one pixel in the experiment. While the offset ratio of the text line was below 20%, the F-measure barely fluctuated. While the offset ratio of the text line exceeded 20%, the performance of the model started to be affected slightly, but the fluctuation around 2% was still acceptable.


## 4.6.4. Backbone

As shown in Table7, a series of experiments comparing different backbones were performed to evaluate its influence on the proposed method. Similar to VGG16, five feature maps generated from VGG11 were gradually upsampled to the original size. For the ResNet series, four feature maps were used to merge. The F-measure using VGG11 was similar to that of using VGG16, but the latter had a slightly slower inference time. Due to the sophisticated design, the ResNet series had a longer convergence time, but the performance was comparatively accurate and stable.Table 7
Detection results with different backbones on CTW1500.
BackboneMethodPrecisionRecallF-measureFPSVGG16Baseline + TL83.880.882.39.2VGG11Baseline + TL82.581.281.911.2ResNet-18Baseline + TL82.479.480.98.7ResNet-50Baseline + TL84.580.882.76.9ResNet-101Baseline + TL84.381.682.96.6


## 4.6.5. Loss Function

As shown in Figure6(a), due to the instability of the enhanced annotation, the F-measure decreased after dozens of epochs on four common datasets, particularly for curved text datasets. As shown in Figure 6(b), training with the text line was unstable relative to the method with full labelling, and the model with full labelling showed better convergence performance with an increasing number of training epochs. After incorporating Uc/e into the loss function, the model with the text line showed improved convergence, with convergence fluctuation of approximately 3%.Figure 6
Influence of training epochs: (a) results for different datasets with the text line and (b) results for the same dataset with different annotations.∗ represents Uc/e used in the loss function.
(a)(b)


## 5. Conclusion and Future Work

In this paper, we first introduced a novel text detector based on weakly supervised learning. The most prominent feature of the method was proposing a novel labelling named the text line and the full use of the model pretrained on SynthText. The use of a text line can help the detector decrease the cost of labelling, and the pretrained model can improve the performance of the detector. The experiments showed that the text line with low-cost labelling can be used to train an effective text detector and further verify the feasibility of using a synthetic text dataset to enhance weak labels. Efficient low-cost text detectors have potential applications in the field of photo translation. Synthetic data will play an increasingly important role in the field of deep learning in the future. One reason for this is that the high cost of annotation hinders the application of actual scenes for arithmetic. Another reason is that synthetic data are increasingly similar to real-world images, and the development of auxiliary methods promotes the development of synthetic text. In future work, it will be important to train the methods with synthetic data but apply them to the real world.



---

*Source: 3871897-2020-06-10.xml*